Files
project57-x/docker-entrypoint.d/40-a-upstream.sh
T
mdszxy 5dc62bd7c4
CI Pipeline / check-commit (push) Successful in 5s
CI Pipeline / deploy-only (push) Has been skipped
CI Pipeline / build (push) Successful in 21s
CI Pipeline / deploy (push) Successful in 17s
fix: start nginx without resolving A-site at boot [deploy]
2026-10-05 20:16:16 +08:00

19 lines
419 B
Bash

#!/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