forked from phoenix/litellm-mirror
set PROXY_BASE_URL when server root path set
This commit is contained in:
parent
0e34d63153
commit
900e89c0ad
1 changed files with 6 additions and 4 deletions
|
@ -281,9 +281,12 @@ except Exception as e:
|
|||
except Exception as e:
|
||||
pass
|
||||
|
||||
server_root_path = os.getenv("SERVER_ROOT_PATH", "")
|
||||
if server_root_path != "" and os.getenv("PROXY_BASE_URL") is None:
|
||||
os.environ["PROXY_BASE_URL"] = server_root_path
|
||||
_license_check = LicenseCheck()
|
||||
premium_user: bool = _license_check.is_premium()
|
||||
ui_link = f"/ui/"
|
||||
ui_link = f"{server_root_path}/ui/"
|
||||
ui_message = (
|
||||
f"👉 [```LiteLLM Admin Panel on /ui```]({ui_link}). Create, Edit Keys with SSO"
|
||||
)
|
||||
|
@ -303,14 +306,13 @@ _description = (
|
|||
else f"Proxy Server to call 100+ LLMs in the OpenAI format. {custom_swagger_message}\n\n{ui_message}"
|
||||
)
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
docs_url=_docs_url,
|
||||
title=_title,
|
||||
description=_description,
|
||||
version=version,
|
||||
root_path=os.environ.get(
|
||||
"SERVER_ROOT_PATH", ""
|
||||
), # check if user passed root path, FastAPI defaults this value to ""
|
||||
root_path=server_root_path, # check if user passed root path, FastAPI defaults this value to ""
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue