Explorar o código

Merge pull request #951 from kamermans/bugfix/ipv6_resolvers

Added support for IPv6 DNS servers in resolver generation (issue #938)
Jason Wilder %!s(int64=7) %!d(string=hai) anos
pai
achega
795e153c2e
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      docker-entrypoint.sh

+ 2 - 2
docker-entrypoint.sh

@@ -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