#!/bin/sh set -e mkdir -p /etc/nginx/templates if [ "$NGINX_SSL_ENABLED" = "true" ]; then echo "Using SSL configuration" cp /templates/ssl.conf.template /templates/default.conf.template else echo "Using non-SSL configuration" cp /templates/nossl.conf.template /templates/default.conf.template fi if [ "$ENVIRONMENT" = "production" ]; then export UI_ROOT="/usr/share/nginx/html" echo "Setting production root to ${UI_ROOT}" else export UI_ROOT="/home" echo "Setting development root to ${UI_ROOT}" fi envsubst '$UI_ROOT' < /templates/default.conf.template > /etc/nginx/templates/default.conf.template