conf package¶
Submodules¶
-
conf.config_utils.
from_envvars
(prefix=None, environ=None, envvars=None, as_json=True)[source]¶ Load environment variables in a dictionary
Values are parsed as JSON. If parsing fails with a ValueError, values are instead used as verbatim strings.
Parameters: - prefix – If
None
is passed as envvars, all variables fromenviron
starting with this prefix are imported. The prefix is stripped upon import. - envvars – A dictionary of mappings of environment-variable-names
to Flask configuration names. If a list is passed
instead, names are mapped 1:1. If
None
, see prefix argument. - environ – use this dictionary instead of os.environ; this is here mostly for mockability
- as_json – If False, values will not be parsed as JSON first.
- prefix – If
-
conf.config_utils.
load_configs
(envvar_prefix, path=None)[source]¶ Load configuration
- The following steps will be undertake:
- It will attempt to load configs from file: if path is provided, it will be used, otherwise the path will be taken from envvar envvar_prefix + “SETTINGS”.
- all envvars starting with envvar_prefix will be loaded.