Fix healthcheck when used with base_path

This commit is contained in:
arabcoders 2025-06-09 20:18:45 +03:00
parent 7bae93a04f
commit e251fba26c

View file

@ -2,6 +2,7 @@
set -euuo pipefail set -euuo pipefail
LOCAL_PORT="${YTP_PORT:-8081}" LOCAL_PORT="${YTP_PORT:-8081}"
BASE_PATH="${YTP_BASE_PATH:-/}"
curl_args=(-f) curl_args=(-f)
@ -10,5 +11,8 @@ if [[ -n "${YTP_AUTH_USERNAME:-}" && -n "${YTP_AUTH_PASSWORD:-}" ]]; then
curl_args+=(-H "Authorization: Basic ${cred}") curl_args+=(-H "Authorization: Basic ${cred}")
fi fi
curl_args+=("http://localhost:${LOCAL_PORT}/api/ping") # strip trailing slashes from BASE_PATH
BASE_PATH=$(echo "${BASE_PATH}" | sed 's:/*$::')
curl_args+=("http://localhost:${LOCAL_PORT}${BASE_PATH}/api/ping")
/usr/bin/curl "${curl_args[@]}" /usr/bin/curl "${curl_args[@]}"