ft_transcendence/nginx/15-local-resolvers.envsh
2025-07-29 14:15:25 +02:00

15 lines
433 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
# DO NOT EDIT THIS FILE
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% }"
export NGINX_RESOLVERS