Fix healthcheck when user:pass are set.

This commit is contained in:
arabcoders 2025-05-13 16:22:19 +03:00
parent 8c308c1ce9
commit bba03702a1
3 changed files with 11 additions and 4 deletions

View file

@ -24,6 +24,7 @@
"cronsim",
"daterange",
"dotenv",
"euuo",
"finaldir",
"flac",
"forcejson",

View file

@ -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."

View file

@ -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[@]}"