birdnet-pipy: disable nginx service when ingress is unavailable

This commit is contained in:
Alexandre
2026-02-15 08:33:14 +01:00
parent 570453fd4c
commit 27a64fd80b
5 changed files with 17 additions and 6 deletions

View File

@@ -1,3 +1,8 @@
## 0.5.0-4 (2026-02-15)
- Disable nginx service when ingress is not active
## 0.5.0-3 (2026-02-15)
- Fix nginx startup without ingress by removing templated resolver dependency
## 0.5.0-2 (2026-02-14)
- Skip ingress nginx configuration when ingress is not active (empty/invalid ingress port)

View File

@@ -99,5 +99,5 @@ schema:
ssl: bool?
slug: birdnet-pipy
url: https://github.com/alexbelgium/hassio-addons/tree/master/birdnet-pipy
version: "0.5.0-2"
version: "0.5.0-4"
webui: "[PROTO:ssl]://[HOST]:[PORT:80]"

View File

@@ -14,10 +14,13 @@ ingress_interface="$(bashio::addon.ip_address)"
ingress_entry="$(bashio::addon.ingress_entry)"
if ! [[ "${ingress_port}" =~ ^[0-9]+$ ]] || [[ "${ingress_port}" -le 0 ]]; then
bashio::log.info "Ingress not active, skipping ingress nginx configuration"
bashio::log.info "Ingress not active, disabling nginx service"
touch /run/nginx-disabled
exit 0
fi
rm -f /run/nginx-disabled
sed -i \
-e "s|proxy_pass http://api|proxy_pass http://127.0.0.1|g" \
-e "s|proxy_pass http://icecast|proxy_pass http://127.0.0.1|g" \
@@ -31,6 +34,3 @@ sed -i \
/etc/nginx/servers/ingress.conf
sed -i "s#%%ingress_entry%%#${ingress_entry}#g" /etc/nginx/includes/ingress_params.conf
# Set DNS resolver for internal requests
sed -i "s/%%dns_host%%/127.0.0.11/g" /etc/nginx/includes/resolver.conf

View File

@@ -1 +1 @@
resolver %%dns_host%%;
resolver 127.0.0.11 ipv6=off;

View File

@@ -1,4 +1,10 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -euo pipefail
if [ -f /run/nginx-disabled ]; then
bashio::log.info "Nginx disabled because ingress is not active"
exec sleep infinity
fi
nginx