1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2024-11-21 19:36:30 +00:00

Added support for IPv6 DNS servers in resolver generation (issue #938)

This commit is contained in:
Steve Kamerman 2017-10-19 20:58:34 -04:00
parent f05f7a0ff9
commit 5d503b48cb
No known key found for this signature in database
GPG Key ID: D39F3EEFC1837DF1

View File

@ -18,8 +18,8 @@ fi
# Note: if $DHPARAM_BITS is not defined, generate-dhparam.sh will use 2048 as a default
/app/generate-dhparam.sh $DHPARAM_BITS
# Compute the DNS resolvers for use in the templates
export RESOLVERS=$(awk '$1 == "nameserver" {print $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g')
# Compute the DNS resolvers for use in the templates - if the IP contains ":", it's IPv6 and must be enclosed in []
export RESOLVERS=$(awk '$1 == "nameserver" {print ($2 ~ ":")? "["$2"]": $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g')
if [ "x$RESOLVERS" = "x" ]; then
echo "Warning: unable to determine DNS resolvers for nginx" >&2
unset RESOLVERS