mehcode / config-rs

⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Apache License 2.0
2.43k stars 206 forks source link

Option to overwrite rather than merge HashMaps #431

Open aeheathc opened 1 year ago

aeheathc commented 1 year ago

I have multiple config sources. For most data types, when a field is available from multiple sources, there's an order of precedence for which one to use. However, one of the fields in my settings struct is a HashMap. I have found that when this field is available from multiple config settings, the HashMaps are merged together, where keys from both sources are present in the deserialized output. I would prefer that one whole HashMap overrides another, to bring the behavior in line with that of the primitive types. Or, at least have an option I can call on the ConfigBuilder to ask for this behavior.