Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test and docs about includes (#796)
closes #794
- Loading branch information
1 parent
eae0773
commit 3200c00
Showing
7 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
|
||
from dynaconf import Dynaconf | ||
|
||
# ISSUE 794 | ||
# WHEN USING INCLUDES | ||
# THE INCLUDES ARE LOADED RELATIVE TO | ||
# THE FIRST LOADED FILE `conf/settings.toml` | ||
settings = Dynaconf( | ||
settings_files=["conf/settings.toml", "conf/.secrets.toml"], | ||
includes=["**/*.toml"], | ||
) | ||
|
||
assert settings.a == 3 | ||
assert settings.b == 2 | ||
assert settings.included_host == "0.0.0.0" | ||
|
||
|
||
# SO.. | ||
# WHEN USING INCLUDES IT IS RECOMMENDED | ||
# TO SET THE ROOT PATH TO THE DIRECTORY | ||
# WHERE THE SCRIPT IS RUNNING | ||
# OR PASS AN ABSOLUTE PATH TO THE root_path or includes | ||
|
||
HERE = os.path.dirname(os.path.abspath(__file__)) | ||
settings_with_root_path = Dynaconf( | ||
root_path=HERE, | ||
settings_files=["conf/settings.toml", "conf/.secrets.toml"], | ||
includes=["conf/**/*.toml"], | ||
) | ||
|
||
assert settings_with_root_path.a == 3 | ||
assert settings_with_root_path.b == 2 | ||
assert settings_with_root_path.included_host == "0.0.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
included_host="0.0.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
a=3 | ||
b=2 |