Switch from hardcoding quad9 to reading resolv.conf

pull/515/head
Andrew Godwin 2023-02-19 10:33:52 -07:00
rodzic 79aea1b8ba
commit aa592b496a
2 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -74,7 +74,7 @@ server {
internal;
# Reconstruct the remote URL
resolver 9.9.9.9 149.112.112.112 ipv6=off;
resolver __NAMESERVER__ valid=10s;
# Unset Authorization and Cookie for security reasons.
proxy_set_header Authorization '';

Wyświetl plik

@ -1,8 +1,12 @@
#!/bin/bash
# Set up cache size
# Set up cache size and nameserver subs
CACHE_SIZE="${TAKAHE_NGINX_CACHE_SIZE:-1g}"
sed s/__CACHESIZE__/${CACHE_SIZE}/g /etc/nginx/conf.d/default.conf.tpl > /etc/nginx/conf.d/default.conf
NAMESERVER=`cat /etc/resolv.conf | grep "nameserver" | awk '{print $2}' | tr '\n' ' '`
if [ -z "$NAMESERVER" ]; then
NAMESERVER="9.9.9.9 149.112.112.112"
fi
sed "s/__CACHESIZE__/${CACHE_SIZE}/g" /etc/nginx/conf.d/default.conf.tpl | sed "s/__NAMESERVER__/${NAMESERVER}/g" > /etc/nginx/conf.d/default.conf
# Run nginx and gunicorn
nginx &