litellm/ui/docker-entrypoint.d/40-litellm-runtime-config.sh
Yassin Kortam f76f7e1368
feat(helm): support a separate hostname per component in the componentized deploy (#46360)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-14 14:56:36 -07:00

32 lines
713 B
Bash
Executable file

#!/bin/sh
set -eu
runtime_dir=/tmp/litellm-ui
runtime_file=$runtime_dir/runtime-config.json
rm -f "$runtime_file" 2>/dev/null || true
if [ "${LITELLM_BACKEND_URL+x}" = "" ]; then
exit 0
fi
newline='
'
case "$LITELLM_BACKEND_URL" in
*"$newline"*)
printf '%s\n' 'WARN: ignoring invalid LITELLM_BACKEND_URL' >&2
exit 0
;;
esac
if ! printf '%s\n' "$LITELLM_BACKEND_URL" | grep -Eq '^https?://[^"\\ ]+$'; then
printf '%s\n' 'WARN: ignoring invalid LITELLM_BACKEND_URL' >&2
exit 0
fi
backend_url=$LITELLM_BACKEND_URL
while [ "${backend_url%/}" != "$backend_url" ]; do
backend_url=${backend_url%/}
done
mkdir -p "$runtime_dir"
printf '{"backend_url":"%s"}\n' "$backend_url" > "$runtime_file"