diff options
-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()) +} |