config-rs
config-rs copied to clipboard
Fix uppercase lowercase isses
fix #340
I have chosen the first approach, which is to use lowercase keys which will make the crate case insensitive, this will allow the user to use uppercase or lowercase keys but internally the keys can be easily matched and overridden since they are all lowercase. As of the caveat I mentioned here I managed to fix it by matching the fields and the keys for lowercase in the deserialization
phase.
Thanks. I will add your suggestion to the chore list 😄
Done and ready for a review.
There is still a bug (as of 0.13.3). Consider this:
let conf: HashMap<String, String> = Config::builder()
.add_source(File::with_name(name))
.add_source(Environment::with_prefix(prefix))
.build()?
.try_deserialize()?;
File:
KEY = "value1"
Env:
PREFIX_KEY=value2
Then:
Current behavior: conf has 2 keys: KEY
& key
with values value1
& value2
Expected behavior: conf has 1 key: KEY
with value value2