-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Only when reading from envvars True and False will be transformed to lowercase to allow toml parser.
- Loading branch information
1 parent
297eefc
commit 97366d6
Showing
11 changed files
with
93 additions
and
9 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
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,4 @@ | ||
DYNACONF_UPPERTRUE=True | ||
DYNACONF_UPPERFALSE=False | ||
DYNACONF_LOWERTRUE=true | ||
DYNACONF_LOWERFALSE=false |
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,23 @@ | ||
from __future__ import annotations | ||
|
||
from dynaconf import Dynaconf | ||
|
||
settings = Dynaconf( | ||
settings_file="settings.toml", | ||
load_dotenv=True, | ||
) | ||
|
||
|
||
# TOML must rely on its own type system | ||
assert settings.TOMLUPPERTRUE == "True" | ||
assert settings.TOMLUPPERFALSE == "False" | ||
assert settings.TOMLLOWERTRUE is True | ||
assert settings.TOMLLOWERFALSE is False | ||
|
||
# ENV vars must transform `True` to `true` and `False` to `false` | ||
assert settings.UPPERTRUE is True, settings.UPPERTRUE | ||
assert settings.UPPERFALSE is False, settings.UPPERFALSE | ||
assert settings.LOWERTRUE is True, settings.LOWERTRUE | ||
assert settings.LOWERFALSE is False, settings.LOWERFALSE | ||
|
||
print("BOOLEAN FIX FOR ENV VARS WORKS") |
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,4 @@ | ||
tomllowertrue = true | ||
tomllowerfalse = false | ||
tomluppertrue = "True" | ||
tomlupperfalse = "False" |