feat: Factor out some uvicorn settings as environment variables (#1266)

This commit is contained in:
Matthew Zhou 2025-03-13 12:26:50 -07:00 committed by GitHub
parent 8d060a0f34
commit e4d8272818
2 changed files with 11 additions and 0 deletions

View File

@ -322,6 +322,9 @@ def start_server(
app,
host=host or "localhost",
port=port or REST_DEFAULT_PORT,
workers=settings.uvicorn_workers,
reload=settings.uvicorn_reload,
timeout_keep_alive=settings.uvicorn_timeout_keep_alive,
ssl_keyfile="certs/localhost-key.pem",
ssl_certfile="certs/localhost.pem",
)
@ -338,4 +341,7 @@ def start_server(
app,
host=host or "localhost",
port=port or REST_DEFAULT_PORT,
workers=settings.uvicorn_workers,
reload=settings.uvicorn_reload,
timeout_keep_alive=settings.uvicorn_timeout_keep_alive,
)

View File

@ -174,6 +174,11 @@ class Settings(BaseSettings):
# telemetry logging
verbose_telemetry_logging: bool = False
# uvicorn settings
uvicorn_workers: int = 1
uvicorn_reload: bool = False
uvicorn_timeout_keep_alive: int = 5
@property
def letta_pg_uri(self) -> str:
if self.pg_uri: