micronaut-core icon indicating copy to clipboard operation
micronaut-core copied to clipboard

Include another YAML configuration in application.yml

Open temofey1989 opened this issue 1 year ago • 5 comments

Feature description

In some cases, our main configuration (applicaiton.yml) is getting too big to manage.

It would be pretty great to have the possibility to include the content of some YAML into application.yml. Quarkus has a similar feature. Example:

...
quarkus:
  config:
    locations:
      - config-1.yml
      - config-2.yml
...

This feature can also be useful when you have a hierarchy of applicaiton-*.yml config files. For instance, I have a application-test.yml which has a common configuration for the test.

logger:
  levels:
    root: DEBUG
...

Then I can have application-testdb.yml:

datasources:
  default:
     ...

Having possibility of including configuration from another file, I can just declare test like this:

@MicronautTest(environments = ["testdb"])
class MyTest : FreeSpec({
    ...
})

instead of:

@MicronautTest(environments = [Environment.TEST, "testdb"])
class MyTest : FreeSpec({
    ...
})

Thanks for the feedback.

temofey1989 avatar Jan 31 '24 11:01 temofey1989