Removes DEPLOY_URL entirely.

This commit is contained in:
Aaron Louie 2020-05-26 10:34:50 -04:00
parent cd51cf3b5b
commit 650bb8f6f1
4 changed files with 6 additions and 20 deletions

View File

@ -29,6 +29,6 @@ RUN chmod +x ./entrypoint.sh
# then starts/reloads nginx. # then starts/reloads nginx.
ENTRYPOINT ["./entrypoint.sh", \ ENTRYPOINT ["./entrypoint.sh", \
"/etc/nginx/html/index.html,/etc/nginx/conf.d/default.conf", \ "/etc/nginx/html/index.html,/etc/nginx/conf.d/default.conf", \
"PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,DEPLOY_URL,PORT0", \ "PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,PORT0", \
"/etc/nginx/html", \ "/etc/nginx/html", \
"true"] "true"]

View File

@ -74,7 +74,6 @@ services:
# environment: # environment:
# - API_URL=http://localhost:5000/v1.0 # - API_URL=http://localhost:5000/v1.0
# - BASE_HREF=/ # - BASE_HREF=/
# - DEPLOY_URL=/bpmn
# - HOME_ROUTE=home # - HOME_ROUTE=home
# - IRB_URL=http://localhost:5001/ # - IRB_URL=http://localhost:5001/
# - PORT0=5002 # - PORT0=5002

View File

@ -42,18 +42,13 @@ else
num_args=4 num_args=4
fi fi
# Find & replace BASE_HREF and DEPLOY_URL in all files in the nginx html directory # Find & replace BASE_HREF in all files in the nginx html directory
if [[ "$2" == *"BASE_HREF"* ]] && [[ "$2" == *"DEPLOY_URL"* ]]; then if [[ "$2" == *"BASE_HREF"* ]]; then
# Add trailing slash to $BASE_HREF if needed # Add trailing slash to $BASE_HREF if needed
length=${#BASE_HREF} length=${#BASE_HREF}
last_char=${BASE_HREF:length-1:1} last_char=${BASE_HREF:length-1:1}
[[ $last_char != "/" ]] && BASE_HREF="$BASE_HREF/"; : [[ $last_char != "/" ]] && BASE_HREF="$BASE_HREF/"; :
# Add trailing slash to $DEPLOY_URL if needed
length=${#DEPLOY_URL}
last_char=${DEPLOY_URL:length-1:1}
[[ $last_char != "/" ]] && DEPLOY_URL="$DEPLOY_URL/"; :
# The third parameter is the absolute path to the nginx html directory # The third parameter is the absolute path to the nginx html directory
if [[ $num_args -ge 3 ]]; then if [[ $num_args -ge 3 ]]; then
# Replace all instances of __REPLACE_ME_WITH_BASE_HREF__ with $BASE_HREF # Replace all instances of __REPLACE_ME_WITH_BASE_HREF__ with $BASE_HREF
@ -63,14 +58,6 @@ if [[ "$2" == *"BASE_HREF"* ]] && [[ "$2" == *"DEPLOY_URL"* ]]; then
echo 'Replacing base href...' echo 'Replacing base href...'
# Wait a few seconds in case find | sed needs more time # Wait a few seconds in case find | sed needs more time
sleep 3 sleep 3
# Replace all instances of __REPLACE_ME_WITH_DEPLOY_URL__ with $DEPLOY_URL
find "$3" \( -type d -name .git -prune \) -o -type f -print0 | \
xargs -0 sed -i 's@__REPLACE_ME_WITH_DEPLOY_URL__@'"$DEPLOY_URL"'@g'
echo 'Replacing deploy URL...'
# Wait a few seconds in case find | sed needs more time
sleep 3
fi fi
fi fi

View File

@ -5,8 +5,8 @@
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build", "build": "ng build",
"build:prod": "ng build --configuration=production --prod --base-href=__REPLACE_ME_WITH_BASE_HREF__ --deploy-url=__REPLACE_ME_WITH_DEPLOY_URL__", "build:prod": "ng build --configuration=production --prod --base-href=__REPLACE_ME_WITH_BASE_HREF__",
"build:staging": "ng build --configuration=staging --prod --base-href=__REPLACE_ME_WITH_BASE_HREF__ --deploy-url=__REPLACE_ME_WITH_DEPLOY_URL__", "build:staging": "ng build --configuration=staging --prod --base-href=__REPLACE_ME_WITH_BASE_HREF__",
"build:test": "ng build --configuration=test", "build:test": "ng build --configuration=test",
"test": "ng test", "test": "ng test",
"test:coverage": "ng test --codeCoverage=true --watch=false --browsers=ChromeHeadless", "test:coverage": "ng test --codeCoverage=true --watch=false --browsers=ChromeHeadless",
@ -21,7 +21,7 @@
"e2e-wf:db-setup": "docker exec -it backend pipenv run flask load-example-data", "e2e-wf:db-setup": "docker exec -it backend pipenv run flask load-example-data",
"e2e-wf:pb-setup": "docker exec -it pb pipenv run flask db upgrade", "e2e-wf:pb-setup": "docker exec -it pb pipenv run flask db upgrade",
"e2e-wf": "npm run e2e-wf:stop && npm run e2e-wf:clean && npm run e2e-wf:build && npm run e2e-wf:start && npm run e2e-wf:db-upgrade && npm run e2e-wf:db-setup && npm run e2e-wf:pb-setup", "e2e-wf": "npm run e2e-wf:stop && npm run e2e-wf:clean && npm run e2e-wf:build && npm run e2e-wf:start && npm run e2e-wf:db-upgrade && npm run e2e-wf:db-setup && npm run e2e-wf:pb-setup",
"env": "chmod +x ./docker/substitute-env-variables.sh && ./docker/substitute-env-variables.sh src/index.html PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,DEPLOY_URL,PORT0", "env": "chmod +x ./docker/substitute-env-variables.sh && ./docker/substitute-env-variables.sh src/index.html PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,PORT0",
"ci": "npm run lint && npm run test:coverage && sonar-scanner" "ci": "npm run lint && npm run test:coverage && sonar-scanner"
}, },
"private": true, "private": true,