Exemplo n.º 1
0
def get(key, default=None):
    value = os.environ.get(upperfy(key))

    # compatibility with renamed variables
    for old, new in RENAMED_VARS.items():
        value = try_renamed(key, value, old, new)

    return (parse_conf_data(value, tomlfy=True)
            if value is not None else default)
Exemplo n.º 2
0
# Currently this is only used by cli. INSTANCE_FOR_DYNACONF specifies python
# dotted path to custom LazySettings instance. Last dotted path item should be
# instance of LazySettings.
INSTANCE_FOR_DYNACONF = get("INSTANCE_FOR_DYNACONF", None)

# https://msg.pyyaml.org/load
YAML_LOADER_FOR_DYNACONF = get("YAML_LOADER_FOR_DYNACONF", "full_load")

# Use commentjson? https://commentjson.readthedocs.io/en/latest/
COMMENTJSON_ENABLED_FOR_DYNACONF = get("COMMENTJSON_ENABLED_FOR_DYNACONF",
                                       False)

# Extra file, or list of files where to look for secrets
# useful for CI environment like jenkins
# where you can export this variable pointing to a local
# absolute path of the secrets file.
SECRETS_FOR_DYNACONF = get("SECRETS_FOR_DYNACONF", None)

# To include extra paths based on envvar
INCLUDES_FOR_DYNACONF = get("INCLUDES_FOR_DYNACONF", [])

# To pre-load extra paths based on envvar
PRELOAD_FOR_DYNACONF = get("PRELOAD_FOR_DYNACONF", [])

# Files to skip if found on search tree
SKIP_FILES_FOR_DYNACONF = get("SKIP_FILES_FOR_DYNACONF", [])

# Backwards compatibility with renamed variables
for old, new in RENAMED_VARS.items():
    setattr(sys.modules[__name__], old, locals()[new])