codepulsar-com / nils

A Java NLS library
https://docs.codepulsar.com/nils/docs/latest/index.html
MIT License
0 stars 0 forks source link

Read adapter configuration from file #69

Open mhuber-dev opened 5 months ago

mhuber-dev commented 5 months ago

Currently to configure an adapter an instance of the configuration must be initialized, but sometimes there are different configuration for development and production (etc.). Changing the java source file before each deployment is error prove or the user must implement an own configuration-file based approche.

Expected behaviour: Beside the configuration via code, the configuration via configuration files should also be possible. The Factory class searches for the configuration file and read the values.

mhuber-dev commented 1 month ago

The prefix for the configuration in the files should be "nils". Example nils-config.yaml

nils:
  config-key: value
  ...

Examle nils-config.properties

nils.config-key: value
...
mhuber-dev commented 1 month ago

Default location should be the root of the classpath-resources with the name "nils-config.properties|json|yaml". But we also add a System.property named "nils.configfile" to overwrite the name as well as the location which can be passed in at the startup via -Dnils.configfile=...