From 795c827de0a1d44521479d000da78c97890b89f5 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 31 May 2020 10:27:16 +0200 Subject: [PATCH] :ambulance: Ensure TLS port has a valid value --- adguard/rootfs/etc/cont-init.d/nginx.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/adguard/rootfs/etc/cont-init.d/nginx.sh b/adguard/rootfs/etc/cont-init.d/nginx.sh index e00ead6..5cf5229 100644 --- a/adguard/rootfs/etc/cont-init.d/nginx.sh +++ b/adguard/rootfs/etc/cont-init.d/nginx.sh @@ -11,10 +11,15 @@ declare dns_host declare ingress_interface declare ingress_port declare keyfile - -if bashio::var.true "$(yq read /data/adguard/AdGuardHome.yaml tls.enabled)"; then - adguard_port=$(yq read /data/adguard/AdGuardHome.yaml tls.port_https) - adguard_protocol=https +declare tls_port + +if bashio::var.true "$(yq read /data/adguard/AdGuardHome.yaml tls.enabled)"; +then + tls_port=$(yq read /data/adguard/AdGuardHome.yaml tls.port_https) + if bashio::var.has_value "${tls_port}" && [[ "${tls_port}" -ne 0 ]]; then + adguard_port="${tls_port}" + adguard_protocol=https + fi fi sed -i "s#%%port%%#${adguard_port}#g" /etc/nginx/includes/upstream.conf