REST API Configuration Reference#
This reference lists the REST API’s operating modes, environment variables, defaults and signing-key requirements. It serves developers and deployment maintainers configuring the API. Command syntax is documented in dioptra-api Command Reference. Python construction and overrides are documented in REST API Application Factory Reference.
Contents
Operating Modes#
The API requires an explicit operating mode.
The dioptra-api dev and dioptra-api prod commands select their corresponding modes regardless of an inherited DIOPTRA_RESTAPI_ENV value.
Python callers can select the mode through an argument or that environment variable.
See Mode Precedence.
Property |
|
|
|---|---|---|
Packaged server |
Flask development server. |
Gunicorn. |
Platforms |
POSIX and native Windows. |
POSIX only. |
Debugging default |
Enabled. May be disabled. |
Disabled. Enabling it is rejected. |
Authentication |
Enabled. May be disabled explicitly. |
Enabled. Disabling it is rejected. |
CORS |
Enabled for the configured origin. |
The development CORS configuration is not applied. |
Session and remember cookies |
The |
Both cookies require the |
Packaged transport |
Local HTTP is permitted. |
Gunicorn must serve HTTPS using TLS 1.3. |
Signing key |
An existing persistent key file is required. |
An existing protected key file is required. |
Debug flags and server selection do not infer a mode. Missing, empty or unsupported modes fail configuration validation.
Environment Variables#
The API reads these variables for each new configuration resolution. An existing application retains its resolved settings. Python callers can supply typed overrides with higher priority.
Boolean values accept case-insensitive true, false, 1 and 0, ignoring surrounding whitespace.
Empty or other boolean values are invalid.
Integer settings accept whole numbers, such as 1000.
Decimal fractions (1000.0) and scientific notation (1e3) are rejected.
Mode and Key Selection#
Variable |
Default |
Accepted values |
|---|---|---|
|
None. |
|
|
|
A nonempty path to an existing key. See Signing-Key Files. |
Production HTTPS Settings#
- DIOPTRA_TLS_ALLOWED_AUTHORITIES#
Hostnames and IP addresses that clients use to reach the API. The API checks each request’s
Hostheader against this list.Production requires a nonempty JSON array, for example
["localhost:8000", "dioptra.example.org"].Include the port when it differs from 443. Omitting it is equivalent to specifying
:443.Enclose IPv6 addresses in square brackets, for example
[::1]:8000.Hostname comparisons ignore letter case.
Requests with a malformed
Hostheader or a value outside this list receive HTTP 400.
Generated deployments configure this list automatically. When running the API directly, set it before starting dioptra-api prod.
Reverse Proxies#
A reverse proxy must connect to the API over HTTPS, verify its server certificate, and send an allowed hostname and port in the Host header.
Forwarded and X-Forwarded-* headers do not override the request’s scheme, hostname, or port.
The generated nginx configuration handles these settings automatically.
See dioptra-api prod for TLS options and ssl.toml key_exchange for deployment key-exchange settings.
API Presentation and Pagination#
Variable |
Default |
Accepted values |
|---|---|---|
|
|
Nonempty origin string used in development. |
|
|
Flask-RESTX documentation-path string. |
|
Unset. |
Nonempty URL scheme string, such as |
|
|
Integer of at least |
Connections and Logging#
Variable |
Default |
Accepted values |
|---|---|---|
|
Absolute SQLite URI for |
Nonempty SQLAlchemy database URI used in both API modes. |
|
|
Nonempty Redis URI with the |
|
MLflow’s |
Nonempty SDK-supported URI passed to the API’s MLflow client. |
|
|
Boolean. |
|
|
Python logging level name normalized to uppercase. |
Signing-Key Files#
API startup reads an existing key. It never creates a key, repairs its permissions or selects a fallback file after a failure. Use dioptra-api init-key to provision it before startup. Keep the file out of source control and avoid displaying its contents in output or logs.
Path and Content#
Property |
Requirement |
|---|---|
Path resolution |
Expand |
File contents |
Exactly 64 lowercase ASCII hexadecimal characters, optionally followed by one LF. |
Key generation |
The hexadecimal text represents 32 cryptographically random bytes. Format validation does not establish the entropy of supplied material. |
Flask value |
The 64-character text, without the optional LF, is used as |
Filesystem Requirements#
Platform |
Startup requirements |
|---|---|
POSIX |
The effective API account owns the immediate parent with mode |
Native Windows development |
The same content format and detectable link/file-type checks apply. POSIX ownership, permissions and no-follow descriptor enforcement are unavailable. Owner-only Windows ACLs are not established. |
Native Windows production |
Unsupported. |
Missing, unreadable, malformed or unsafe key files stop startup. The initializer’s permission repairs and interrupted-initialization behavior are documented in init-key.
Retired Environment Variables#
The presence of either variable below causes an error, even when its replacement or a Python override is supplied. Diagnostics identify setting names without printing credential values.
Retired variable |
Replacement |
|---|---|
|
Provision a key file and select its path with |
|
|