diff options
author | BonfaceKilz | 2021-02-12 22:31:25 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-02-12 22:31:25 +0300 |
commit | 9dd23ef8c8ed003be130c212374ffa71f230c463 (patch) | |
tree | 0a97e37968e143129002c1a9daf5390a47358b75 | |
parent | adb9a6e3d570c86cf902d6293b30fc1f0f27df82 (diff) | |
download | genenetwork3-9dd23ef8c8ed003be130c212374ffa71f230c463.tar.gz |
Add configuration file for the project
-rw-r--r-- | gn3/file_utils.py | 4 | ||||
-rw-r--r-- | gn3/settings.py | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gn3/file_utils.py b/gn3/file_utils.py index d6e1c66..a6929e1 100644 --- a/gn3/file_utils.py +++ b/gn3/file_utils.py @@ -5,6 +5,7 @@ import os from functools import partial from typing import Dict +from gn3.settings import APP_DEFAULTS def get_dir_hash(directory: str) -> str: @@ -30,7 +31,8 @@ ENVIRON_VAR/ROOT_DIR/FILE_NAME does not exist, raise an exception. Otherwise return ENVIRON_VAR/ROOT_DIR/FILE_NAME. """ - _dir = os.environ.get(environ_var) + _dir = APP_DEFAULTS.get(environ_var, + os.environ.get(environ_var)) if _dir: _file = os.path.join(_dir, root_dir, file_name) if os.path.isfile(_file): diff --git a/gn3/settings.py b/gn3/settings.py new file mode 100644 index 0000000..d8d5986 --- /dev/null +++ b/gn3/settings.py @@ -0,0 +1,9 @@ +"""Configuration settings for this project""" + +import tempfile +import os + +APP_DEFAULTS = { + "GEMMA_WRAPPER_CMD": os.environ.get("GEMMA_WRAPPER", "gemma-wrapper"), + "TMPDIR": os.environ.get("TMPDIR", tempfile.gettempdir()) +} |