unis_crm/frontend/nginx/start.sh

14 lines
422 B
Bash

#!/bin/sh
RESOLVER=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}' | head -1)
BACKEND_HOST=${BACKEND_HOST:-crm-backend.default.svc.cluster.local}
BACKEND_PORT=${BACKEND_PORT:-8080}
sed \
-e "s|\${RESOLVER}|$RESOLVER|g" \
-e "s|__BACKEND_HOST__|$BACKEND_HOST|g" \
-e "s|__BACKEND_PORT__|$BACKEND_PORT|g" \
/etc/nginx/default.conf.template > /etc/nginx/conf.d/default.conf
exec nginx -g "daemon off;"