From 912bd343c5a091f4669e8c9a74541023285a9057 Mon Sep 17 00:00:00 2001 From: Natalie Schultz <90212258+nataliejschultz@users.noreply.github.com> Date: Thu, 16 May 2024 17:46:19 -0600 Subject: [PATCH] Hardcoded webhost Changes to set the webhost to 0.0.0.0 at all times --- .docker/docker_start_script.sh | 9 --------- Dockerfile | 2 +- emission/net/api/config.py | 13 ------------- setup/tests/start_script.sh | 2 ++ 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/.docker/docker_start_script.sh b/.docker/docker_start_script.sh index daf82b32e..0b3f38d7e 100644 --- a/.docker/docker_start_script.sh +++ b/.docker/docker_start_script.sh @@ -12,15 +12,6 @@ if [ -z ${DB_HOST} ] ; then fi cat conf/storage/db.conf -#set Web Server host using environment variable -echo ${WEB_SERVER_HOST} -if [ -z ${WEB_SERVER_HOST} ] ; then - local_host=`hostname -i` - export WEB_SERVER_HOST=$local_host - echo "Setting webserver host environment variable to localhost" -fi -cat conf/net/api/webserver.conf - if [ -z ${LIVERELOAD_SRC} ] ; then echo "Live reload disabled, " else diff --git a/Dockerfile b/Dockerfile index 7fa923ea0..521e7194f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN bash -c "./.docker/setup_config.sh" # #declare environment variables ENV DB_HOST='' -ENV WEB_SERVER_HOST='' +ENV WEB_SERVER_HOST=0.0.0.0 ENV LIVERELOAD_SRC='' ENV STUDY_CONFIG='' diff --git a/emission/net/api/config.py b/emission/net/api/config.py index 31e0e34c0..7c78e6391 100644 --- a/emission/net/api/config.py +++ b/emission/net/api/config.py @@ -14,25 +14,12 @@ def get_config_data_from_env(): } return config_data_env -def check_unset_env_vars(): - config_data_env = { - "static_path": os.getenv('WEB_SERVER_STATIC_PATH'), - "server_host": os.getenv('WEB_SERVER_HOST'), - "server_port": os.getenv('WEB_SERVER_PORT'), - "socket_timeout": os.getenv('WEB_SERVER_TIMEOUT'), - "auth_method": os.getenv('WEB_SERVER_AUTH'), - "aggregate_call_auth": os.getenv('WEB_SERVER_AGGREGATE_CALL_AUTH'), - "not_found_redirect": os.getenv('WEB_SERVER_REDIRECT_URL') - } - return not any(config_data_env.values()) - def get_config_data(): try: config_file = open('conf/net/api/webserver.conf') ret_val = json.load(config_file) config_file.close() except: - # Check if all Webserver environment variables are not set # if check_unset_env_vars(): logging.debug("webserver not configured, falling back to sample, default configuration") ret_val = get_config_data_from_env() diff --git a/setup/tests/start_script.sh b/setup/tests/start_script.sh index 0fe21ed1a..d9bb52eef 100644 --- a/setup/tests/start_script.sh +++ b/setup/tests/start_script.sh @@ -9,6 +9,8 @@ if [ -z ${DB_HOST} ] ; then export DB_HOST=$local_host echo "Setting db host environment variable to localhost" fi + +export WEB_SERVER_HOST=0.0.0.0 cat conf/storage/db.conf echo "Setting up conda..."