New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Env vars are case sensitive (overriding only uppercase params if written in uppercase) when merge_enabled=True #737
Comments
@abalakh this is a bug, env vars are case insensitive only on windows because on windows every env var is forced to be upper case, on linux it should have worked |
@abalakh does it work if you set DYNACONF_MY_SECTION__my_param=othervalue ?? ^that must work, however with all upper must also work if the key already exists in the settings. |
@rochacbruno yes, with lowercase everything works. That's what i'm currently using as workaround. |
@rochacbruno There is a similar issue. An empty lowercase YAML key value isn't overridden by an uppercase environment variable even when
Dynaconf is from the master branch (3.1.10.dev0) |
@bartolootrit I found the problem you described and it has to do with how dictionaries are ordered. The env_loader is getting data as: {'LEVEL1': {'KEY4': 'new_key_value', 'key': 'key_value', 'KEY2': None, 'key3': None, 'key4': None}} And as dicts considers only latest added elements the None is there, I am thinking on a way to solve it. |
I think it might be fixed on this PR #795 @bartolootrit @abalakh |
@rochacbruno Yes. Thank you. |
Let's say i have very simple yaml config with envs:
And i want to override
my_param
with env variable at some point. What's proper env var name for such case?DYNACONF_MY_SECTION__MY_PARAM
works ifmerge_enabled=False
.However, if
merge_enabled=True
,DYNACONF_MY_SECTION__MY_PARAM
will set my_section.MY_PARAM, not my_section.my_param.Easy reproducer:
Running the code returns the following output:
setting
merge_enabled=False
and re-running the code returns expected output:Documentation is kinda confusing about this behavior, so i'm not 100% sure it's a bug:
On the one hand, https://www.dynaconf.com/envvars/ examples are showing uppercase env vars are correctly recognized:
And it works like that with
merge_enabled=False
On the other - there's the following line:
And there's https://www.dynaconf.com/configuration/#lowercase_read , so it looks like only the first level keys are designed to be case insensitive.
I'm using dynaconf 3.1.7, OS is macOS 12.2.1 if that matters.
The text was updated successfully, but these errors were encountered: