Files
nginx-proxy-manager/docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/40-dynamic.sh
Jamie Curnow 67d40e186f
All checks were successful
Close stale issues and PRs / stale (push) Successful in 38s
Attempt to fix #5335 by allowing resovler generation to be opt-out with a env var
2026-02-26 08:32:02 +10:00

17 lines
684 B
Bash
Executable File

#!/command/with-contenv bash
# shellcheck shell=bash
set -e
log_info 'Dynamic resolvers ...'
# Dynamically generate resolvers file, if resolver is IPv6, enclose in `[]`
# thanks @tfmm
if [ "$(is_true "${DISABLE_RESOLVER:-}")" = '0' ]; then
if [ "$(is_true "${DISABLE_IPV6:-}")" = '1' ]; then
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) ipv6=off valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
else
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
fi
fi