config
config copied to clipboard
Document EXACT behavior of override_with_env_vars
As far as I can understand by re-reading the README, the behavior should be like this:
Default is value substitution only:
# If environment variables "value1_from_env=yep" and "key1=nope" are defined
# Then `key1` will have value "yep"
key1 = ${value1_from_env}
then we get to the interesting part,
With -Dconfig.override_with_env_vars=true
:
# If environment variable "CONFIG_FORCE_val1" is set, its value will be assigned to `key1`
key1 = "val1"
fine,
However a quirk that seems to be missing from the current docs is that
with -Dconfig.override_with_env_vars=true
:
# For top-level / non-mangled keys only
# If environment variable "key1=val1" is set, its value will be assigned to `key1` DESPITE not being prefixed with "CONFIG_FORCE_"
# But
# If a "mangled" environment variable "CONFIG_FORCE_key1=val2" is also set, ITS value will take precedence
key1 = "val1"
If this is a bug, I suspect that it will be difficult to fix without a major version bump, because quite a few projects are likely to already depend on this behavior.
(N.b. I tested through Scala only)