Using typesafe config, how do I override the reference configuration with an environment variable? For example, lets say I have the following configuration:
foo: "bar"
I want it to be overriden with the environment variable FOO
if one exists.
Using typesafe config, how do I override the reference configuration with an environment variable? For example, lets say I have the following configuration:
foo: "bar"
I want it to be overriden with the environment variable FOO
if one exists.
If I correctly understood your question, the answer is here. You can do
If you have to use environment variables and if their naming is consistent with config names you can use a bash script like this to automatically convert from your environment vars to JVM cmd args. These
-D
JVM args will override Typesafe Config values. Example:Convert upper to lower case, do substring operations on env vars as you please if they don't directly map to your config values.