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 |
§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.