-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Picking up values from environment not working #47
Comments
It works with the latest version, which I did not quite have - I had 0,.6 from the github README. I also checked with the 0.7.0 via crates.io. Also works. One thing though, that caused trouble for my brain at least: The simple example is broken, because the "APP" prefix[1] used there will not match because it is not lowercased before matching with the already lc-ed key. [1] config-rs/examples/simple/src/main.rs Line 12 in eca93d3
Lowercasing should be here Line 34 in eca93d3
|
I found one more issue with reading the environment. The separator (default '_') is not split once, but several times. For example, if you have APP_CACHE_SIZE in the environment, you do not get a config var "cache_size", but two vars, 'cache' and 'size' (I guess in a hierarchy, but I did not check that). I found this counter-intuitive when working with env vars. If this is not a bug, but intended behaviour, a special note in the docs would help avoid this interpretation. |
It was intended. A key like I don't want to remove this entirely (as done in #56) but I'd be okay with disabling it by default and having perhaps: Environment::with_prefix("APP").separator("_") |
Hi,
I am trying to use the environment only, to grep the configuration. Because that did not work, I also tried with an additional Settings.toml. Then the value from file is picked up, but not the environment.
Code:
Settings.toml:
foo = "20"
Calling the program with
APP_FOO=10 target/debug/prog
. Only the value from toml is picked up.I must be doing something very stupid, but I cannot get this to work. Can you spot my error?
UPDATE Also tried the simple example, with APP_DEBUG=FOO without success. The toml file wins.
The crazy thing is that to me the code in Environment looks fine, I am just not getting what is going on.
UPDATE
See new comment #47 (comment) below.
The text was updated successfully, but these errors were encountered: