From e835e95c64e15139e4a6e6e28588bb656e5c1ece Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 18 Feb 2025 17:19:30 +0100 Subject: [PATCH] Update 99-run.sh --- .../rootfs/etc/cont-init.d/99-run.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/immich_power_tools/rootfs/etc/cont-init.d/99-run.sh b/immich_power_tools/rootfs/etc/cont-init.d/99-run.sh index f0e34f9c1..2a291a3b5 100755 --- a/immich_power_tools/rootfs/etc/cont-init.d/99-run.sh +++ b/immich_power_tools/rootfs/etc/cont-init.d/99-run.sh @@ -4,17 +4,18 @@ bashio::log.info "Starting Immich Power Tools" # Ensure DB_HOST has no proto in front extract_ip_or_domain() { - local url=$1 + local url="$1" if [[ ! "$url" =~ ^https?:// ]]; then bashio::warning "URL $url has a http:// or https:// prefix. This should not be, it is removed automatically" echo "$url" | sed -E 's|https?://([^/]+).*|\1|' fi } -export DB_HOST="$(extract_ip_or_domain "$DB_HOST")" +DB_HOST="$(extract_ip_or_domain "$DB_HOST")" +export DB_HOST # Function to ensure URL has http:// or https:// prefix ensure_http_prefix() { - local url=$1 + local url="$1" if [[ ! "$url" =~ ^https?:// ]]; then bashio::warning "URL $url does not have http:// or https:// prefix. Adding http:// by default. If cannot connect to immich, please adapt in your addon options" echo "http://$url" @@ -22,8 +23,11 @@ ensure_http_prefix() { echo "$url" fi } + # Ensure IMMICH_URL and EXTERNAL_IMMICH_URL have http:// or https:// prefix -export IMMICH_URL="$(ensure_http_prefix "$IMMICH_URL")" -export EXTERNAL_IMMICH_URL="$(ensure_http_prefix "$EXTERNAL_IMMICH_URL")" +IMMICH_URL="$(ensure_http_prefix "$IMMICH_URL")" +export IMMICH_URL +EXTERNAL_IMMICH_URL="$(ensure_http_prefix "$EXTERNAL_IMMICH_URL")" +export EXTERNAL_IMMICH_URL sudo -u nextjs node server.js