PromucFlow_constructor/app/client/docker/start-nginx.sh
Shrikant Sharat Kandula 7a0ec72304
fix: Treat missing server proxy endpoing as a warning (#7094)
Currently, in the editor Docker image, if the APPSMITH_SERVER_PROXY_PASS env variable is missing or set to empty, then the service will notify the user and refuses to start. This PR will change this behaviour to use a default value for this variable and attempt to start.
2021-09-06 15:30:45 +05:30

37 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# This script is baked into the appsmith-editor Dockerfile and is used to boot Nginx when the Docker container starts
# Refer: /app/client/Dockerfile
set -o errexit
set -o xtrace
if [ -z "$APPSMITH_SERVER_PROXY_PASS" ]; then
export APPSMITH_SERVER_PROXY_PASS='http://localhost:8080'
echo "No explicit value for APPSMITH_SERVER_PROXY_PASS, using '$APPSMITH_SERVER_PROXY_PASS'."
fi
cp /nginx-root.conf.template /etc/nginx/nginx.conf
if [ -f /nginx.conf.template ]; then
# This is to support installations where the docker-compose.yml file would mount a template confi at this location.
app_template=/nginx.conf.template
elif [ -z "$APPSMITH_SSL_CERT_PATH" ]; then
if [ -z "$APPSMITH_DOMAIN" ]; then
export APPSMITH_DOMAIN=_
fi
app_template=/nginx-app-http.conf.template
else
if [ -z "$APPSMITH_DOMAIN" ]; then
echo "APPSMITH_DOMAIN is required when SSL is enabled." >&2
exit 2
fi
app_template=/nginx-app-https.conf.template
fi
cat "$app_template" \
| envsubst "$(printf '$%s,' $(env | grep -Eo '^APPSMITH_[A-Z0-9_]+'))" \
| sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' \
| tee /etc/nginx/conf.d/default.conf
exec nginx -g 'daemon off;'