refactor(settings): validate cross-field rules in the model

The "AUTH_TYPE=oidc requires OIDC_ISSUER, OIDC_CLIENT_ID and
OIDC_FRONTEND_URL" check lived in app.py, so it only ran when the Flask
app was imported; a worker or script with the same misconfiguration
started fine. It is now a model validator on the auth group and runs
wherever Settings is loaded, with the same message.

DEPLOYMENT_TYPE, which app.py read straight from the environment to
decide whether a missing JWT_SECRET_KEY is fatal, is a documented
setting on the server group now, so it shows up in the reference like
every other variable the app reads.
This commit is contained in:
arc53-machine committed 2026-09-17 11:09:09 +01:00
1 parent 95d0799494
commit a8dab8864d
5 files changed
+43 -12

No files matched your search

+7
View File
@@ -12,6 +12,13 @@ from docsgpt.core.settings._shared import SettingsGroup
class ServerSettings(SettingsGroup):
"""Serving the UI, public URLs, and process-level knobs of the API server."""
DEPLOYMENT_TYPE: Optional[str] = Field(
default=None,
description=(
"Deployment class, e.g. cloud or production. A production class refuses to run without a "
"configured JWT_SECRET_KEY instead of generating a local one on disk."
),
)
SERVE_UI: bool = Field(
default=True, description="Serve the web UI shipped in the package (docsgpt/static) from the API process."
)