#!/bin/sh set -eu CONF=/etc/nginx/conf.d/default.conf A_UPSTREAM="${A_UPSTREAM:-http://project57-deploy.ns-project57.svc.cluster.local:3000}" A_UPSTREAM="${A_UPSTREAM%/}" NS="$(awk '/^nameserver/{print $2; exit}' /etc/resolv.conf || true)" if [ -z "${NS}" ]; then NS=kube-dns.kube-system.svc.cluster.local fi sed -i \ -e "s|__RESOLVER__|${NS}|g" \ -e "s|__A_UPSTREAM__|${A_UPSTREAM}|g" \ "${CONF}" nginx -t