Skip to content

Commit

Permalink
pull config.yml from /etc/hsds/ if /config/config.yml not found
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed May 21, 2020
1 parent bda977f commit 5b7a0f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ MAINTAINER John Readey <jreadey@hdfgroup.org>
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
Expand Down
4 changes: 2 additions & 2 deletions hsds/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 5b7a0f1

Please sign in to comment.