Files
2026-01-08 13:44:21 +01:00

39 lines
1.2 KiB
Plaintext

#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
# ==============================================================================
# Set variables
slug=readarr
port=8787
CONFIG_LOCATION=/config/config.xml
# Wait for transmission to become available
bashio::net.wait_for "$port" localhost 900
# Delete external
if grep -q "external" "$CONFIG_LOCATION"; then
bashio::log.warning "external is set, restarting"
sed -i "/external/d" "$CONFIG_LOCATION"
bashio::addon.restart
fi
# Set UrlBase
if ! grep -q "<UrlBase>$slug</UrlBase>" "$CONFIG_LOCATION" && ! bashio::config.true "ingress_disabled"; then
bashio::log.warning "BaseUrl not set properly, restarting"
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "/<Config>/a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
bashio::addon.restart
fi
echo ""
if bashio::config.true "ingress_disabled"; then
bashio::log.info "Ingress is disabled. You can connect at http://homeassistant:$(bashio::addon.port 8787)"
else
bashio::log.info "Ingress is enabled. You can connect from HA or at http://homeassistant:$(bashio::addon.port 8787)/readarr"
fi
echo ""
bashio::log.info "Starting NGinx..."
exec nginx