瀏覽代碼

web: auto-detect nginx resolver

Take it from /etc/resolv.conf in case it wasn't provided via the env
variable.

Fixes: https://github.com/jitsi/docker-jitsi-meet/issues/1430
Saúl Ibarra Corretgé 2 年之前
父節點
當前提交
53b2654556
共有 2 個文件被更改,包括 10 次插入1 次删除
  1. 3 1
      web/rootfs/defaults/nginx.conf
  2. 7 0
      web/rootfs/etc/cont-init.d/10-config

+ 3 - 1
web/rootfs/defaults/nginx.conf

@@ -26,7 +26,9 @@ http {
 
 
 	client_max_body_size 0;
 	client_max_body_size 0;
 
 
-	resolver {{ .Env.NGINX_RESOLVER | default "127.0.0.11" }};
+	{{ if .Env.NGINX_RESOLVER }}
+	resolver {{ .Env.NGINX_RESOLVER }};
+	{{ end -}}
 
 
  	include /etc/nginx/mime.types;
  	include /etc/nginx/mime.types;
 	types {
 	types {

+ 7 - 0
web/rootfs/etc/cont-init.d/10-config

@@ -63,6 +63,13 @@ if [[ $DISABLE_HTTPS -ne 1 ]]; then
     fi
     fi
 fi
 fi
 
 
+# Detect nameserver for Nginx, if not specified.
+if [[ -z "$NGINX_RESOLVER" ]]; then
+    export NGINX_RESOLVER=$(grep nameserver /etc/resolv.conf | cut -d" " -f2 | tr "\n" " " | sed -e "s/[[:space:]]*$//")
+fi
+
+echo "Using Nginx resolver: =$NGINX_RESOLVER="
+
 # copy config files
 # copy config files
 tpl /defaults/nginx.conf > /config/nginx/nginx.conf
 tpl /defaults/nginx.conf > /config/nginx/nginx.conf