Open molntamas opened 4 months ago
Hi, @molntamas
On #1001 we added this feature, however it is not released yet, we are considering changing it completely and NOT release on the version 3.3.0
If you install from git right now, you can have it working as
export DYNACONF_SETTINGS___0__NAME="value"
On environment variables we have no many chars to use, so we need to resolve with underscores only, which makes this feature a little bit confusing, did you notice triple underscore for index ___0
and double for keys __NAME
, it is easy to commit the mistake on the _
count, one alternative would be using something like:
export DYNACONF_SETTINGS__i0__NAME=value
the i0
is easier to readm however would conflict with a dictionary having a "i0"
as a key.
We are discussing it and thinking about to not release this on 3.3.0.
And for 4.0.0 come with a different syntax.
export DYNACONF_SETTINGS='@merge 0 name=value'
We are still discussing how the grammar would work on #1155 and this still needs to be implemented, so probably will happen only on 4.0.0
So to summarize, there is no way right now, you could write your own loader or hook to support it on your end or wait until we have a decision for how this going to work.
Also, you can help us to make the decision, what do you think would the best grammar?
Hi @rochacbruno, Thanks for getting back to me!
To me both syntaxes look fine. Since we already have to be cautious with double underscore, triple underscore doesn't sound so bad to me. I'd personally propably pick the 3 underscore version.
Would be great if in some way this would be available, then I wouldn't have to implement it extra.
@rochacbruno could you point me to some example how I could implement this behaviour with a hook/loader? Thank you!
I have this kind of YAML config:
I'm wondering how I can override the settings "test1", "value1", etc. via environment variables? Or if it is possible to add a new setting with environment variable for default_SETTINGS0NEW_SETTING="value". I was checking documentation and some GitHub Issues but couldn't make it work. Thank you!