Expand description
Server configuration with startup validation.
Loads configuration from environment variables and validates that all required values are present at startup, not at first use.
§Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | prod | - | PostgreSQL connection string |
JWT_SECRET | prod | dev default | JWT signing secret |
WORKER_TOKEN | prod | dev default | Worker-to-API auth token |
PORT | no | 3000 | HTTP listen port |
ALLOWED_ORIGINS | no | same-origin | Comma-separated CORS origins |
DASHBOARD_DIR | no | embedded | Filesystem path to dashboard assets |
WEBHOOK_URL | no | - | Outbound webhook URL for notifications |
IRONFLOW_ENV | no | development | production or development |
RATE_LIMIT_AUTH | no | 10 | Auth rate limit (req/min/IP). 0 = disabled |
RATE_LIMIT_GENERAL | no | 60 | General rate limit (req/min/IP). 0 = disabled |
ARTIFACTS_DIR | no | - | Filesystem root for artifact blobs. Unset disables artifacts |
ARTIFACT_MAX_BYTES | no | 104857600 | Maximum size of a single artifact |
PURGE_MAX_AGE_DAYS | no | 90 | Runs older than this are purged |
PURGE_MAX_RUNS_PER_WORKFLOW | no | 1000 | Max terminal runs kept per workflow |
PURGE_DRY_RUN | no | false | Log what would be purged without deleting |
PURGE_INTERVAL_SECS | no | 86400 | Seconds between purge ticks (min 60) |
§Examples
use ironflow_api::config::ServerConfig;
let config = ServerConfig::from_env()?;
println!("Listening on port {}", config.port);Structs§
- Config
Error - Configuration validation error.
- Server
Config - Server configuration loaded from environment variables.