settings
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| ApiSettings docler_api.settings Settings of the API server. |
🛈 DocStrings¶
Server settings of the Docler API, read from the environment.
ApiSettings
dataclass
¶
Settings of the API server.
Source code in src/docler_api/settings.py
cors_origins
class-attribute
instance-attribute
¶
Origins allowed to call the API from a browser; none (CORS off) by default.
max_upload_bytes
class-attribute
instance-attribute
¶
Largest request body accepted; bigger ones get 413.
token
class-attribute
instance-attribute
¶
Bearer token clients must send (Authorization: Bearer <token>).
from_env
classmethod
¶
from_env() -> ApiSettings
Read the settings from DOCLER_API_* environment variables.
Source code in src/docler_api/settings.py
check_bind
¶
check_bind(host: str, settings: ApiSettings) -> None
Refuse to serve on a non-loopback host without a token.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If |
Source code in src/docler_api/settings.py
is_loopback
¶
Whether a host name or address only accepts local connections.