Skip to content
Snippets Groups Projects
Commit 3fe4be3f authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Avoid duplication of path

parent e2a9238a
Branches
No related tags found
No related merge requests found
......@@ -41,16 +41,6 @@ def get_dirs(application_name):
dirs["data"] = this_or_else(os.environ.get("XDG_DATA_HOME"), default_data_home)
dirs["config"] = this_or_else(os.environ.get("XDG_CONFIG_HOME"), default_config_home)
# Override this directory from Environment variable
key = "{}_DATA_DIR".format(application_name.upper().replace(" ", "_").replace("-", "_"))
if os.getenv(key) is not None:
dirs["data"] = os.getenv(key)
# Override this directory from Environment variable
key = "{}_CONFIG_DIR".format(application_name.upper().replace(" ", "_").replace("-", "_"))
if os.getenv(key) is not None:
dirs["config"] = os.getenv(key)
return dirs
......@@ -67,7 +57,7 @@ def initialize_config(application_name: str, default_config: str) -> dict:
# Generate a environment variable name from the application name
# E.g. "foo bar" becomes "FOO_BAR_CONFIG_PATH"
config_path_environment_variable = "{}_CONFIG_PATH".format(application_name.upper().replace(" ", "_"))
config_path_environment_variable = "{}_CONFIG_DIR".format(application_name.upper().replace(" ", "_"))
# If the environment variable is set, use that as a config path, otherwise use the default one
config_dir = this_or_else(os.environ.get(config_path_environment_variable), dirs["config"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment