From 2976a687c69234afe0f4987c7aa04ed6e4924544 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Mon, 25 May 2020 09:29:21 -0400 Subject: [PATCH] Actually adds trailing slash like it's supposed to. --- docker/docker-compose.yml | 2 +- docker/substitute-env-variables.sh | 4 ++-- nginx.conf | 9 ++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index bb978c0..6ed0496 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -71,7 +71,7 @@ services: # image: sartography/cr-connect-bpmn:$E2E_TAG # environment: # - API_URL=http://localhost:5000/v1.0 -# - BASE_HREF=/ +# - BASE_HREF=/bpmn # - HOME_ROUTE=home # - IRB_URL=http://localhost:5001 # - PORT0=5002 diff --git a/docker/substitute-env-variables.sh b/docker/substitute-env-variables.sh index ff43bb5..7abae2c 100755 --- a/docker/substitute-env-variables.sh +++ b/docker/substitute-env-variables.sh @@ -32,7 +32,7 @@ fi if [[ "$2" == *"BASE_HREF"* ]]; then length=${#BASE_HREF} last_char=${BASE_HREF:length-1:1} - [[ $last_char == "/" ]] && BASE_HREF="$BASE_HREF"; : + [[ $last_char != "/" ]] && BASE_HREF="$BASE_HREF/"; : # The third parameter is the absolute path to the nginx html directory if [[ $# -ge 3 ]]; then @@ -50,7 +50,7 @@ fi env_list="\\\$${2//,/ \\\$}" # "\" and "$" are escaped as "\\" and "\$" for file_path in ${1//,/ } do - echo "replacing $env_list in $file_path" + echo "replacing environment variables in $file_path" # Replace strings in the given file(s) in env_list envsubst "$env_list" < "$file_path" > "$file_path".tmp && mv "$file_path".tmp "$file_path" diff --git a/nginx.conf b/nginx.conf index ea80879..dba1d24 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,15 +1,10 @@ server { listen $PORT0; - - location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri$args $uri$args/ /index.html =404; - } + root /usr/share/nginx/html; + index index.html index.htm; location $BASE_HREF/ { alias /usr/share/nginx/html; - index index.html index.htm; try_files $uri$args $uri$args/ $BASE_HREF/index.html =404; }