check for RESOLVERS env variable before computing dns to make the variable work as intended
This commit is contained in:
parent
c33dedf10b
commit
2afe9ca853
1 changed files with 10 additions and 5 deletions
|
|
@ -18,11 +18,16 @@ fi
|
||||||
# Note: if $DHPARAM_BITS is not defined, generate-dhparam.sh will use 2048 as a default
|
# Note: if $DHPARAM_BITS is not defined, generate-dhparam.sh will use 2048 as a default
|
||||||
/app/generate-dhparam.sh $DHPARAM_BITS
|
/app/generate-dhparam.sh $DHPARAM_BITS
|
||||||
|
|
||||||
# Compute the DNS resolvers for use in the templates - if the IP contains ":", it's IPv6 and must be enclosed in []
|
# Check if the RESOLVERS environment variable has been set
|
||||||
export RESOLVERS=$(awk '$1 == "nameserver" {print ($2 ~ ":")? "["$2"]": $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g')
|
if [ "x$RESOLVERS" != "x" ]; then
|
||||||
if [ "x$RESOLVERS" = "x" ]; then
|
echo "RESOLVERS environment variable set to '$RESOLVERS', skipping dns compute from resolv.conf" >&2
|
||||||
echo "Warning: unable to determine DNS resolvers for nginx" >&2
|
else
|
||||||
unset RESOLVERS
|
# 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
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the user has run the default command and the socket doesn't exist, fail
|
# If the user has run the default command and the socket doesn't exist, fail
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue