Configuration#
Everything the serving app needs is one frozen, keyword-only
ServeConfig(allowed_origins=..., ...) handed to create_app. Because
credentials and endpoints are constructor arguments everywhere (see
Configuration), a caller reads the environment and passes the
result in — fastrag.serve itself never reads os.environ.
Required: allowed_origins#
The one required field. The app configures its own CORSMiddleware from this
list, so callers never add a middleware themselves. A "*" wildcard is
rejected at construction — credentialed CORS cannot use
Access-Control-Allow-Origin: * — so a browser-targeted deployment must
enumerate its origins.
Every field#
Field |
Default |
Meaning |
|---|---|---|
|
— (required) |
CORS origins |
|
|
|
|
|
|
|
— |
how long a session (and its chats) live without activity |
|
— |
minimum headroom before an expiry bump is written |
|
— |
reject a larger request body with |
|
— |
reject a longer |
|
— |
cap (422 beyond), checked by counting messages |
|
— |
cap (422 beyond), checked by counting chats |
|
— |
end-to-end budget; a timeout lands as |
|
— |
seconds between SSE keep-alive comments and lock-connection pings |
|
— |
root logger level for the JSON log output |
|
|
enable the bearer-token path and |
|
|
mount |
|
|
bearer token guarding |
|
|
trust |
|
|
enforce the three limits below at all (Admission: rate limiting and client IP/country) |
|
|
limit on the generation endpoints, per client IP |
|
|
limit on the two |
|
|
limit on minting a new session, per client IP |
|
|
path to a GeoLite2-Country |
Every field is validated in __post_init__ — a bad value fails at the line
that constructed the config, not at startup.
See also#
HTTP API for the routes these fields gate; Metrics for what
GET /metrics exports; Admission: rate limiting and client IP/country for rate limiting and client
IP/country resolution; examples/14_serving.py for a complete ServeConfig
and create_app wiring.