From 5b7a0f1fa1cd67d1fa789099f6bde89a183ca1ba Mon Sep 17 00:00:00 2001 From: jreadey Date: Thu, 21 May 2020 09:06:25 -0700 Subject: [PATCH] pull config.yml from /etc/hsds/ if /config/config.yml not found --- Dockerfile | 3 +++ hsds/config.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b011a96d..5a7383d1 100755 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,9 @@ MAINTAINER John Readey RUN mkdir /usr/local/src/hsds-src/ /usr/local/src/hsds/ COPY . /usr/local/src/hsds-src RUN pip install /usr/local/src/hsds-src/ --no-deps +RUN rm -rf /usr/local/src/hsds-src +RUN mkdir /etc/hsds/ +COPY admin/config/config.yml /etc/hsds/ COPY entrypoint.sh / EXPOSE 5100-5999 diff --git a/hsds/config.py b/hsds/config.py index ff4faa24..e4075273 100755 --- a/hsds/config.py +++ b/hsds/config.py @@ -19,7 +19,7 @@ def _load_cfg(): # load config yaml yml_file = None - for config_dir in [".", "/config"]: + for config_dir in [".", "/config", "/etc/hsds/"]: file_name = os.path.join(config_dir, "config.yml") if os.path.isfile(file_name): yml_file = file_name @@ -28,7 +28,7 @@ def _load_cfg(): msg = "unable to find config file" print(msg) raise FileNotFoundError(msg) - print(f"_load_cfg with '{yml_file}''") + print(f"_load_cfg with '{yml_file}'") try: with open(yml_file, "r") as f: yml_config = yaml.safe_load(f)