This commit is contained in:
maix0 2025-06-16 16:37:20 +02:00 committed by Maieul BOYER
parent aa96d79e47
commit 1bc33ab912
28 changed files with 94 additions and 18 deletions

15
nginx/15-local-resolvers.envsh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
# if $NGINX_RESOLVERS set to local, set it to the local resolvers from /etc/resolv.conf and export it
set -eu
LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NGINX_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {if ($2 ~ ":") {print "["$2"]"} else {print $2}}' /etc/resolv.conf)
# remove trailing space
NGINX_RESOLVERS="${NGINX_RESOLVERS% }"
echo "_${NGINX_RESOLVERS}_"
export NGINX_RESOLVERS