File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,28 @@ set -Eeuo pipefail
4
4
trap " echo TRAPed signal" HUP INT QUIT TERM
5
5
6
6
# configure nginx DNS settings to match host, why must we do that nginx?
7
- conf=" resolver $( /usr/bin/awk ' BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf) ;"
8
- [ " $conf " = " resolver ;" ] && echo " no nameservers found" && exit 0
7
+ export RESOLVERS=$( awk ' $1 == "nameserver" {print ($2 ~ ":")? "["$2"]": $2}' ORS=' ' /etc/resolv.conf | sed ' s/ *$//g' )
8
+ if [ " x$RESOLVERS " = " x" ]; then
9
+ echo " Warning: unable to determine DNS resolvers for nginx" >&2
10
+ exit 66
11
+ fi
12
+
13
+ echo " DEBUG, determined RESOLVERS from /etc/resolv.conf: '$RESOLVERS '"
14
+
15
+ conf=" "
16
+ for ONE_RESOLVER in ${RESOLVERS} ; do
17
+ echo " Possible resolver: $ONE_RESOLVER "
18
+ conf=" resolver $ONE_RESOLVER ; "
19
+ done
20
+
21
+ echo " Final chosen resolver: $conf "
9
22
confpath=/etc/nginx/resolvers.conf
10
23
if [ ! -e $confpath ] || [ " $conf " != " $( cat $confpath ) " ]
11
24
then
25
+ echo " Using auto-determined resolver '$conf ' via '$confpath '"
12
26
echo " $conf " > $confpath
27
+ else
28
+ echo " Not using resolver config, keep existing '$confpath ' -- mounted by user?"
13
29
fi
14
30
15
31
# The list of SAN (Subject Alternative Names) for which we will create a TLS certificate.
You can’t perform that action at this time.
0 commit comments