diff --git a/radarr/config.json b/radarr/config.json index a52b4148e..95101e911 100644 --- a/radarr/config.json +++ b/radarr/config.json @@ -83,5 +83,5 @@ }, "slug": "radarr_nas", "url": "https://github.com/alexbelgium/hassio-addons/tree/master/radarr", - "version": "4.3.2.6857-9" -} + "version": "4.3.2.6857-10" +} \ No newline at end of file diff --git a/radarr/rootfs/etc/cont-init.d/50-disable_ingress.sh b/radarr/rootfs/etc/cont-init.d/50-disable_ingress.sh deleted file mode 100644 index 9dc660f92..000000000 --- a/radarr/rootfs/etc/cont-init.d/50-disable_ingress.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bashio -# shellcheck shell=bash - -################### -# Disable Ingress # -################### - -if bashio::config.true "ingress_disabled"; then - bashio::log.warning "Ingress is disabled. You'll need to connect using ip:port" - rm /etc/nginx/servers/ingress.conf - rm -r /etc/services.d/nginx - # Set base url - CONFIG_LOCATION=/config/addons_config/radarr/config.xml - if bashio::config.has_value 'CONFIG_LOCATION'; then - CONFIG_LOCATION="$(bashio::config 'CONFIG_LOCATION')" - # Modify if it is a base directory - if [[ "$CONFIG_LOCATION" == *.* ]]; then CONFIG_LOCATION="$(dirname $CONFIG_LOCATION)"; fi - CONFIG_LOCATION="$CONFIG_LOCATION"/config.xml - if grep -q "UrlBase" "$CONFIG_LOCATION" || true; then - bashio::log.warning "BaseUrl removed, restarting" - sed -i "/UrlBase/d" "$CONFIG_LOCATION" - bashio::addon.restart - fi - fi -fi diff --git a/radarr/rootfs/etc/index.html b/radarr/rootfs/etc/index.html new file mode 100644 index 000000000..6da5fc6e8 --- /dev/null +++ b/radarr/rootfs/etc/index.html @@ -0,0 +1,12 @@ + + + + Ingress is disabled! + + +

+ Ingress was disabled by the user. Please connect using ip:port or + re-enable in the addons options. +

+ + diff --git a/radarr/rootfs/etc/services.d/nginx/run b/radarr/rootfs/etc/services.d/nginx/run index 8cba95aed..7bfa8012b 100644 --- a/radarr/rootfs/etc/services.d/nginx/run +++ b/radarr/rootfs/etc/services.d/nginx/run @@ -5,7 +5,7 @@ # Wait for transmission to become available bashio::net.wait_for 7878 localhost 900 -# Set base url +# Set Config location CONFIG_LOCATION=/config/addons_config/radarr/config.xml if bashio::config.has_value 'CONFIG_LOCATION'; then CONFIG_LOCATION="$(bashio::config 'CONFIG_LOCATION')" @@ -14,12 +14,30 @@ if bashio::config.has_value 'CONFIG_LOCATION'; then CONFIG_LOCATION="$CONFIG_LOCATION"/config.xml fi -if ! grep -q "/radarr" "$CONFIG_LOCATION"; then +# Set UrlBase +if ! grep -q "/radarr" "$CONFIG_LOCATION" && ! bashio::config.true "ingress_disabled"; then bashio::log.warning "BaseUrl not set properly, restarting" sed -i "/UrlBase/d" "$CONFIG_LOCATION" sed -i "//a \/radarr<\/UrlBase>" "$CONFIG_LOCATION" bashio::addon.restart fi +# Disable Ingress +if bashio::config.true "ingress_disabled"; then + bashio::log.warning "Ingress is disabled. You'll need to connect using ip:port" + + # Adapt ingress.conf + sed -i "proxy_pass/i root /etc;" /etc/nginx/servers/ingress.conf + sed -i "proxy_pass/i root /index.html;" /etc/nginx/servers/ingress.conf + sed -i "/proxy_pass/" /etc/nginx/servers/ingress.conf + + # Remove BaseUrl + if grep -q "UrlBase" "$CONFIG_LOCATION" || true; then + bashio::log.warning "BaseUrl removed, restarting" + sed -i "/UrlBase/d" "$CONFIG_LOCATION" + bashio::addon.restart + fi +fi + bashio::log.info "Starting NGinx..." exec nginx