-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for setting and storing configuration from additional sources. This enables a setting to have values coming from a default, environment and programmatic sources. The default priority of the sources is (lowest to highest): 1. Default 2. Environment 3. Programmatic The active source can be retrieved using a new method: `get_source()`: ```python class Config: foo = Env.var(int, "FOO", default=0) cfg = Config() assert cfg.foo == 0 assert cfg.source_type("foo") == "default" os.environ["FOO"] = 123 cfg = Config() assert cfg.foo == 123 assert cfg.source_type("foo") == "environment" ```
- Loading branch information
1 parent
91a8446
commit 2a35499
Showing
2 changed files
with
109 additions
and
19 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