Environment Variables¶
EDRI behavior is configured primarily through environment variables. This page documents all variables the framework reads, their defaults, and what they control.
Runtime mode¶
ENVIRONMENT¶
Attribute |
Value |
|---|---|
Values |
|
Default |
|
The value is case-insensitive. Only an explicit development selects development. An unset or empty variable is production, and any other value (for example prod or staging) is also treated as production and logs a warning at startup, so a missing or mistyped value can never enable the development-only endpoints. Set ENVIRONMENT=development for local work. The variable is named ENVIRONMENT; EDRI_ENVIRONMENT is not read, and setting it alone logs a warning.
Behavior:
Aspect |
Development |
Production |
|---|---|---|
|
Enabled |
Disabled |
API timing in responses |
Included |
Stripped |
Watcher debounce delay |
1 second |
10 seconds |
Error detail |
Full traceback |
Minimal |
Health checks¶
EDRI_HEALTH_CHECK_TIMEOUT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Interval (seconds) between health-check pings to Manager processes.
EDRI_HEALTH_CHECK_FAILURE_LIMIT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Consecutive missed health checks before a Manager is considered unhealthy.
EDRI_HEALTH_CHECK_LOG¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
When false, the periodic HealthCheck event is not written to the debug log as
it passes through the Router, Broker, Scheduler, and Manager processes. Only the
routine per-cycle trace lines are affected; missed-health-check warnings and
errors, and the /edri/health endpoints, are unchanged.
CORS¶
EDRI_CORS_ORIGINS¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Allowed CORS origins (comma-separated if multiple).
EDRI_CORS_HEADERS¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Allowed CORS headers.
EDRI_CORS_CREDENTIALS¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Whether Access-Control-Allow-Credentials is set.
EDRI_CORS_MAX_AGE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Max age (seconds) for CORS preflight caching.
API responses¶
Boolean convention: Truthy values (case-insensitive):
1,true,yes,on.
EDRI_API_RESPONSE_TIMEOUT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
How long (seconds) the API layer waits for an event response.
EDRI_API_SENDER_THREADS¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Size of the Broker's outbound Non-blocking outbound send (sender pool) — how many simultaneously slow clients can be served before further sends queue. See Broker.
EDRI_API_RESPONSE_WRAPPED¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Controls response shape:
True— wrapped:{"data": {...}, "status": "OK"}False— unwrapped:{"status": "OK", ...fields...}
EDRI_API_RESPONSE_TIMING¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Include timing information in API responses.
EDRI_API_CACHE_CONTROL¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Value for the Cache-Control HTTP response header.
EDRI_API_CACHE_HEADERS¶
Attribute |
Value |
|---|---|
Type |
|
Default |
Value of |
Additional headers appended to the Vary response header for cache control.
EDRI_API_ENABLE_DOCUMENTATION¶
Attribute |
Value |
|---|---|
Type |
|
Default |
dev: |
When enabled, the built-in API documentation page is available at /edri/docs. Disable in production to hide internal API structure.
EDRI_API_ENABLE_TOPOLOGY¶
Attribute |
Value |
|---|---|
Type |
|
Default |
dev: |
When enabled, GET /edri/topology exposes the live routing graph — see Router. Disabled by default in production; while disabled, REST returns 404 and the endpoint is absent from the generated /edri/docs page. Over gRPC, Topology still appears in reflection (this flag isn't consulted at schema-generation time) but every call fails NOT_FOUND — see gRPC.
EDRI_API_EXPOSE_ERROR_DETAILS¶
Attribute |
Value |
|---|---|
Type |
|
Default |
dev: |
When enabled, error responses include detailed exception messages and context. Disable in production to avoid leaking internal information.
Server binding and TLS¶
EDRI_HOST¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Host address to bind the API server to.
EDRI_PORT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Port to bind the API server to.
EDRI_GRPC_HOST¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Host address GRPCListener binds to — see gRPC. Independent of EDRI_HOST; only read if start_grpc() is called.
EDRI_GRPC_PORT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Port GRPCListener binds to — see gRPC. Independent of EDRI_PORT; only read if start_grpc() is called.
EDRI_SSL_KEY¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Path to the TLS private key file.
EDRI_SSL_CERTIFICATE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Path to the TLS certificate file.
Switch / Router connection¶
EDRI_SWITCH_HOST¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Switch server hostname or IP address.
EDRI_SWITCH_PORT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Switch server TCP port.
EDRI_SWITCH_SECRET¶
Attribute |
Value |
|---|---|
Type |
|
Default |
(unset) |
Pre-shared key the Switch and every Connector authenticate with, at least 32
bytes. The Switch refuses to bind to any non-loopback address without it, and a
Connector refuses to dial a non-loopback Switch without it; on loopback both run
unauthenticated. The key is cluster-wide — it authenticates against outsiders,
not between members. Read by edri.protocol.keys.
EDRI_SWITCH_SECRET_FILE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
(unset) |
Path to a file holding one key per line; blank lines and # comments are
ignored. Multiple lines let a rotation keep the old and new key valid at once.
Takes precedence over EDRI_SWITCH_SECRET. Prefer this over the inline value,
which is readable through /proc, docker inspect, and pod specs.
EDRI_SWITCH_MAX_MESSAGE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Largest frame payload the Switch will accept and a Connector will send. Read on both sides independently, so raise it on every peer or not at all. Bulk data belongs on a SharedMemoryPipe.
EDRI_SWITCH_STATUS_ENABLED¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Start the Switch's read-only HTTP Status endpoint.
EDRI_SWITCH_STATUS_HOST¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Bind address for the Switch status endpoint.
EDRI_SWITCH_STATUS_PORT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
TCP port for the Switch status endpoint.
Cache¶
EDRI_CACHE_TIMEOUT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
How long (seconds) events stay in the Router cache. Used to survive transient Switch outages.
EDRI_CACHE_INFO_MESSAGE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Interval (seconds) at which the Router logs cache statistics (current size, etc.).
Router outbound queues¶
Per-connection backpressure for the Router's non-blocking fan-out. See Router.
EDRI_ROUTER_OUTBOUND_QUEUE_SOFT_LIMIT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Outbound backlog (queued events) at which a Manager is flagged WARNING. Events keep queueing.
EDRI_ROUTER_OUTBOUND_QUEUE_HARD_LIMIT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Outbound backlog at which a Manager is disconnected and restarted; it replays from the Router cache on re-subscribe.
EDRI_ROUTER_OUTBOUND_JOIN_TIMEOUT¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Seconds the Router waits for an outbound worker thread to drain and stop when a connection is unregistered or the Router shuts down.
Uploads¶
EDRI_UPLOAD_FILES_PREFIX¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Filename prefix for uploaded files stored on disk.
EDRI_UPLOAD_FILES_PATH¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Directory where uploaded files are stored.
Important: EDRI does not automatically delete uploaded files from this directory. Uploaded files may be processed asynchronously by managers or workers, so the framework cannot reliably know when a file is no longer needed. Application code must move, delete, or otherwise manage uploaded files. See Uploads.
Templates and assets¶
EDRI_TEMPLATE_PATH¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Directory containing Jinja2 template files (relative to the working directory, or absolute).
EDRI_ASSETS_PATH¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Directory for static files served for URLs that no event route matches (relative to the working directory, or absolute). Read when edri.config.setting is imported; a relative path is resolved against the working directory on each request. Everything in it is public — see Static files.
Request body limits¶
EDRI_MAX_BODY_SIZE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Maximum accepted HTTP request body size in bytes.
EDRI_MAX_MESSAGE_SIZE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Maximum accepted WebSocket message (text or binary) size in bytes.
EDRI_ASGI_OPTIONS¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
JSON object with arbitrary options passed directly to the ASGI server configuration
(uvicorn.Config, hypercorn.Config, or daphne.Server). Keys and values depend
on the server in use — see its documentation for available parameters.
# example
EDRI_ASGI_OPTIONS='{"ws_ping_interval": 10, "ws_ping_timeout": 10}'
With uvicorn, workers runs N worker processes instead of one, each sharing
the same listening socket and feeding the same Broker queue — see
Multi-worker Listener (uvicorn workers)
for measured throughput and how to size it.
EDRI_ASGI_OPTIONS='{"workers": 4}'
EDRI_CHUNK_SIZE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Default SharedMemoryPipe slot size (bytes).
EDRI_MAX_FILE_SIZE¶
Attribute |
Value |
|---|---|
Type |
|
Default |
|
Maximum accepted file upload size in bytes.
Note: Default is
100 MiB(1024 * 1024 * 100). The current release does not implement a special "unlimited" value. Use a large positive integer if you need a higher upload limit.
Quick reference table¶
Variable |
Default |
Description |
|---|---|---|
|
|
Runtime mode |
|
|
Health check interval (seconds) |
|
|
Max consecutive health check failures |
|
|
Trace periodic health-check events in the log |
|
|
Allowed CORS origins |
|
|
Allowed CORS headers |
|
|
Allow CORS credentials |
|
|
CORS preflight max age (seconds) |
|
|
API response timeout (seconds) |
|
|
Broker outbound sender-pool size |
|
|
Wrap API responses in |
|
dev: |
Include timing in responses |
|
|
Cache-Control header value |
|
|
Additional Vary headers |
|
dev: |
Enable built-in API docs at |
|
dev: |
Enable |
|
dev: |
Include exception details in error responses |
|
|
API server bind host |
|
|
API server bind port |
|
|
gRPC server bind host |
|
|
gRPC server bind port |
|
|
TLS private key path |
|
|
TLS certificate path |
|
|
Switch host |
|
|
Switch port |
|
(unset) |
Pre-shared auth key; required off loopback |
|
(unset) |
Path to a one-key-per-line file; wins over |
|
|
Largest frame payload in bytes (64 MiB) |
|
|
Start the Switch status endpoint |
|
|
Switch status endpoint bind host |
|
|
Switch status endpoint port |
|
|
Router cache timeout (seconds) |
|
|
Cache stats log interval (seconds) |
|
|
Outbound backlog that flags a Manager WARNING |
|
|
Outbound backlog that disconnects + restarts a Manager |
|
|
Seconds to wait for an outbound worker to stop |
|
|
Uploaded file prefix |
|
|
Upload directory |
|
|
Jinja2 templates directory |
|
|
Static assets directory |
|
|
Max request body size |
|
|
Max WebSocket message size |
|
|
JSON passthrough to ASGI server config |
|
|
SharedMemoryPipe slot size |
|
|
Max file upload size |
See also¶
Deployment — production deployment guide
Switch — Switch configuration
Connector — Connector configuration
Router — Router cache configuration
API — API response configuration