15 lines
437 B
Bash
Executable file
15 lines
437 B
Bash
Executable file
#!/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
|