kumuluz / kumuluzee

Lightweight open-source framework for developing microservices using standard Java EE technologies and migrating Java EE to cloud-native architecture.
https://ee.kumuluz.com
MIT License
291 stars 71 forks source link

Added support for multiple file configuration sources #154

Open urbim opened 5 years ago

urbim commented 5 years ago

Enabled usage of multiple file configuration sources. For example now you can define both config.yml and META-INF/microprofile-config.properties at the same time.

Also additional custom file configuration sources can be defined. For example:

config.yml:

example-value: 123

kumuluzee:
  config:
    additional-config-files:
      - config.prod.yml
      - config.docker.yml

config.prod.yml:

example-value: 456

kumuluzee:
  server:
    http:
      port: 8090

config.docker.yml:

another-example: from-docker-yaml

The property example-value will be 456 (additional config files override the default configuration files).

Ordinals

The default configuration files will have an ordinal of 100 (101, 102, ... if more than one are present).

Additional configuration files will have an ordinal one higher than the highest ordinal of the default configuration files. If more than one additional configuration files are defined the one with the smallest index will have the highest ordinal.

In the example above, the config.yml will have an ordinal of 100 (lowest priority), the config.docker.yml will have an ordinal of 101 and the config.prod.yml will have an ordinal of 102 (highest priority).

Of course, every ordinal can be manually set by defining the config_ordinal property in the configuration source (as per MicroProfile Config specification). For example:

config.docker.yml:

config_ordinal: 200

another-example: from-docker-yaml
gpor0 commented 5 years ago

Hi there!

Thumbs up for the feature.

How does com.kumuluz.ee.configuration.file setting affects this feature?

Is it possible to define default config.yml in project and override it with file specified in com.kumuluz.ee.configuration.file setting? I believe com.kumuluz.ee.configuration.file file must have config_ordinal > 100 then?