-
-
Notifications
You must be signed in to change notification settings - Fork 318
Hierarchy in .secrets.toml overwrites settings in settings.toml #649
Copy link
Copy link
Closed
Labels
Milestone
Description
Thanks for the great library and your support!
Describe the bug
Using hierarchy in .secrets.toml overwrites settings in settings.toml.
To Reproduce
Steps to reproduce the behavior:
- Having the following folder structure
Project structure
files/testing/settings.toml
files/testing/.secrets.toml
src/main.py- Having the following config files:
Config files
files/testing/settings.toml
[default]
[default.db]
name="name_default"and
files/testing/.secrets.toml**
[default]
[default.db]
password = 'default_password'- Having the following app code:
Code
/src/main.py
from dynaconf import LazySettings
settings = LazySettings(
environments=True,
ENV_FOR_DYNACONF="default",
ENVVAR_PREFIX_FOR_DYNACONF="none",
load_dotenv=True,
settings_files="../files/testing/settings.toml;../files/testing/.secrets.toml",
)
print(settings.db)- Executing under the following environment
Execution
$ python3 ./src/main.pyActual behavior
Print: {'password': 'default_password'}
Expected behavior
Print: {'name': 'name_default', 'password': 'default_password'}
Environment (please complete the following information):
- OS: Linux 10 (buster)
- Python: 3.9.1
- Dynaconf Version: 3.1.5
- Frameworks in use: none
Additional context
Removing hierarchy from .secrets.toml results in expected behavior:
Changing
files/testing/.secrets.toml
Details
[default]
password = 'default_password'and
/src/main.py
Details
from dynaconf import LazySettings
settings = LazySettings(
environments=True,
ENV_FOR_DYNACONF="default",
ENVVAR_PREFIX_FOR_DYNACONF="none",
load_dotenv=True,
settings_files="../files/testing/settings.toml;../files/testing/.secrets.toml",
)
print(settings.db)
print(settings.password)Results in the following output:
{'name': 'name_default'}
default_passwordReactions are currently unavailable