mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-03-04 00:01:36 +01:00
Refactor nginx ingress script for clarity
Remove redundant sed commands and clean up nginx configuration handling.
This commit is contained in:
@@ -13,19 +13,17 @@ ingress_port="$(bashio::addon.ingress_port)"
|
||||
ingress_interface="$(bashio::addon.ip_address)"
|
||||
ingress_entry="$(bashio::addon.ingress_entry)"
|
||||
|
||||
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" \
|
||||
/etc/nginx/servers/nginx.conf
|
||||
|
||||
if ! [[ "${ingress_port}" =~ ^[0-9]+$ ]] || [[ "${ingress_port}" -le 0 ]]; then
|
||||
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" \
|
||||
/etc/nginx/servers/nginx.conf
|
||||
|
||||
cp /etc/nginx/servers/nginx.conf /etc/nginx/servers/ingress.conf
|
||||
sed -i \
|
||||
-e "s|listen 80;|listen ${ingress_interface}:${ingress_port} default_server;|g" \
|
||||
|
||||
Reference in New Issue
Block a user