mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix(proxy_cli.py): support database_host, database_username, database_password, database_name
This commit is contained in:
parent
a494b5b2f3
commit
8ce8680a9a
1 changed files with 16 additions and 0 deletions
|
@ -556,6 +556,22 @@ def run_server(
|
||||||
**key_management_settings
|
**key_management_settings
|
||||||
)
|
)
|
||||||
database_url = general_settings.get("database_url", None)
|
database_url = general_settings.get("database_url", None)
|
||||||
|
if database_url is None:
|
||||||
|
# Check if all required variables are provided
|
||||||
|
database_host = os.getenv("DATABASE_HOST")
|
||||||
|
database_username = os.getenv("DATABASE_USERNAME")
|
||||||
|
database_password = os.getenv("DATABASE_PASSWORD")
|
||||||
|
database_name = os.getenv("DATABASE_NAME")
|
||||||
|
|
||||||
|
if (
|
||||||
|
database_host
|
||||||
|
and database_username
|
||||||
|
and database_password
|
||||||
|
and database_name
|
||||||
|
):
|
||||||
|
# Construct DATABASE_URL from the provided variables
|
||||||
|
database_url = f"postgresql://{database_username}:{database_password}@{database_host}/{database_name}"
|
||||||
|
os.environ["DATABASE_URL"] = database_url
|
||||||
db_connection_pool_limit = general_settings.get(
|
db_connection_pool_limit = general_settings.get(
|
||||||
"database_connection_pool_limit",
|
"database_connection_pool_limit",
|
||||||
LiteLLMDatabaseConnectionPool.database_connection_pool_limit.value,
|
LiteLLMDatabaseConnectionPool.database_connection_pool_limit.value,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue