From bba03702a13a2d74c37accaf768ae3a3fe4df84e Mon Sep 17 00:00:00 2001 From: arabcoders Date: Tue, 13 May 2025 16:22:19 +0300 Subject: [PATCH] Fix healthcheck when user:pass are set. --- .vscode/settings.json | 1 + app/library/config.py | 1 - healthcheck.sh | 13 ++++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a33e3d15..1df8c357 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,6 +24,7 @@ "cronsim", "daterange", "dotenv", + "euuo", "finaldir", "flac", "forcejson", diff --git a/app/library/config.py b/app/library/config.py index 62a58770..37174644 100644 --- a/app/library/config.py +++ b/app/library/config.py @@ -157,7 +157,6 @@ class Config: pictures_backends: list[str] = [ "https://unsplash.it/1920/1080?random", "https://picsum.photos/1920/1080", - "https://spaceholder.cc/i/1920x1080", "https://placedog.net/1920/1080", ] "The list of picture backends to use for the background." diff --git a/healthcheck.sh b/healthcheck.sh index 3b507f3d..7af3db58 100644 --- a/healthcheck.sh +++ b/healthcheck.sh @@ -1,7 +1,14 @@ #!/usr/bin/env bash - -set -eu pipefail +set -euuo pipefail LOCAL_PORT="${YTP_PORT:-8081}" -/usr/bin/curl -f "http://localhost:${LOCAL_PORT}/api/ping" +curl_args=(-f) + +if [[ -n "${YTP_AUTH_USERNAME:-}" && -n "${YTP_AUTH_PASSWORD:-}" ]]; then + cred=$(printf '%s:%s' "${YTP_AUTH_USERNAME}" "${YTP_AUTH_PASSWORD}" | base64 | tr -d '\n') + curl_args+=(-H "Authorization: Basic ${cred}") +fi + +curl_args+=("http://localhost:${LOCAL_PORT}/api/ping") +/usr/bin/curl "${curl_args[@]}"