django-configurations
django-configurations copied to clipboard
Add option to let DictValue be merged
Would be awesome if the default could be set, and the envvar value is merged into this default :)
https://django-configurations.readthedocs.org/en/stable/values/#configurations.values.DictValue
So if this was done:
default = {
'foo': 'val1',
'bar': 'val2',
}
MY_SETTING = values.DictValue(default)
export DJANGO_MY_SETTING="{'foo':'my new cal'}"
Then the value of settings.MY_SETTING would have keys for both foo and bar.
Thoughts?
This can be achieved currently using the setup methods: https://django-configurations.readthedocs.org/en/stable/patterns/#setup-methods
What about merging it there from a var/setting with another name, e.g. DJANGO_MY_SETTING_ADD?
Ah cool! Using the setup methods elsewhere, but hadn't considered for this. You sure this isn't a helpful enough pattern to make it a flag? It would seem rather intuitive behaviour if provided :)
I'm not too convinced, but would not vote against it.
Let's wait for other opinions.
In my opinion, using setup methods is clunky. How do we sell django-configurations' advantages if the result of code like this is cumbersome (and less readable). I have a similar issue in #217.