ft_transcendence/nginx/15-local-resolvers.envsh
maix0 37403d304a feat(shared): reworked shared library
Shared library is now access using `@shared/module`
2025-07-29 14:14:44 +02:00

14 lines
409 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% }"
export NGINX_RESOLVERS