forked from austintgriffith/burner-wallet
-
Notifications
You must be signed in to change notification settings - Fork 5
/
script.sh
16 lines (10 loc) · 831 Bytes
/
script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# This process is required as React only will listen to env variables at build time so we pass them in through nginx
# see: https://www.manifold.co/blog/building-a-production-grade-container-for-your-static-javascript-application-b2b2eff83fbd
NGINX_SUB_FILTER=$(cat .env.production | grep '=' | sort | sed -e 's/REACT_APP_\([a-zA-Z0-9_]*\)=\(.*\)/sub_filter\ \"NGINX_REPLACE_\1\" \"$\{\1\}\";/')
cat nginx.conf.sample | sed -e "s|LOCATION_SUB_FILTER|$(echo $NGINX_SUB_FILTER)|" | sed 's|}";\ |}";\n\t|g' > default.template
# Trim off the REACT_APP prefix from environment variables
# cat .env.production | grep = | sort | sed -e 's|REACT_APP_\([a-zA-Z0-9_]*\)=\(.*\)|\1=\2|' > .env.production.temp
# mv .env.production.temp .env.production
envsubst < default.template > default.conf
rm default.template
nginx -g "daemon off;"