aloneguid / config

⚙ Config.Net - the easiest configuration framework for .NET developers. No BS.
MIT License
641 stars 85 forks source link

Store each value based on where it came from #71

Closed maelgrove closed 1 year ago

maelgrove commented 5 years ago

The current implementation stores each change into every IConfigStore registered when setting a configuration value, which absolutely makes no sense since you wouldn't want to have your persistent file configuration values end up in a more temporary location, like the environment variables upon setting them. The library should keep track of where a certain configuration value has been retrieved from (using an internal dictionary which maps keys to configuration stores) and only persist them based on their origin.

maelgrove commented 5 years ago

I've created a branch for this over here: config/values-to-origin however I'm not quite sure whether to pursue this any further. On one side, it fits the principle of least surprise, as configuration values which originally haven't been defined in a configuration store won't be stored everywhere upon setting them. However, that way it will not be possible to set a configuration value at all if it isn't defined somewhere, which is why a lot of the tests break.

aloneguid commented 1 year ago

Nah, that would make things very complicated.