dynaconf
dynaconf copied to clipboard
[bug] Default environment always loaded, also when var is already defined
Describe the bug As i understand from reading the code, the default environment is implemented by adding it to the environment list in build_env_list(). This means, however, that if a change my environment (in my case using from_env) the default settings overwrite the existing settings (again as i understand). This seems like undesirable behavior to me, as i expect default settings to only be set when they are not defined already.
To Reproduce Steps to reproduce the behavior: use below config files and perform: from config.config import settings as base_cfg cfg = base_cfg.from_env(env2, keep=True).from_env(env1, keep=True) print(cfg.TEST) desired result should be False, but is True
- Having the following config files:
Config files
/path/settings.toml
[default]
TEST = true
[env1]
[env2]
TEST = false
I think this is related to https://github.com/rochacbruno/dynaconf/issues/344
I think this is related to #344
It is a duplicate indeed I think. My apologies