Skip to main content

Module config

Module config 

Source
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

VariableRequiredDefaultDescription
DATABASE_URLprod-PostgreSQL connection string
JWT_SECRETyes, except explicit devrandom in explicit devJWT signing secret, >= 32 bytes
WORKER_TOKENyes, except explicit devrandom in explicit devWorker-to-API auth token, >= 32 bytes
PORTno3000HTTP listen port
ALLOWED_ORIGINSnosame-originComma-separated CORS origins
DASHBOARD_DIRnoembeddedFilesystem path to dashboard assets
WEBHOOK_URLno-Outbound webhook URL for notifications
IRONFLOW_ENVnounset (strict)production, or development for explicit dev mode
IRONFLOW_INSECURE_COOKIESnofalse1/true drops the Secure flag from session cookies (local HTTP-only dev). Ignored in production
RATE_LIMIT_AUTHno10Credential routes rate limit (sign-in, sign-up, password change), req/min per caller and per targeted email. 0 = disabled
RATE_LIMIT_GENERALno60General rate limit (req/min/IP). 0 = disabled
SSE_MAX_CONNECTIONS_PER_PRINCIPALno5Simultaneous SSE streams per user or API key owner. 0 = disabled
SSE_MAX_CONNECTIONSno1000Simultaneous SSE streams for the whole server. 0 = disabled
ARTIFACTS_DIRno-Filesystem root for artifact blobs. Unset disables artifacts
ARTIFACT_MAX_BYTESno104857600Maximum size of a single artifact
PURGE_MAX_AGE_DAYSno90Runs older than this are purged
PURGE_MAX_RUNS_PER_WORKFLOWno1000Max terminal runs kept per workflow
PURGE_DRY_RUNnofalseLog what would be purged without deleting
PURGE_INTERVAL_SECSno86400Seconds between purge ticks (min 60)
PROVIDER_ACCOUNT_USAGE_RETENTION_DAYSno30Days of Provider Account usage history kept (min 1)
SIGNAL_RETENTION_DAYSno7Days received signals are kept (min 1)
ARTIFACT_BACKENDnolocalBlob storage backend: local or s3
ARTIFACT_S3_BUCKETif s3-S3 bucket name
ARTIFACT_S3_REGIONnoeu-west-1S3 region
ARTIFACT_S3_ENDPOINTno-Custom S3 endpoint (MinIO, R2)
ARTIFACT_S3_PREFIXno-Key prefix within the bucket
ARTIFACT_GC_INTERVAL_SECSno86400Seconds between GC ticks (min 60)
ARTIFACT_GC_GRACE_DAYSno7Days before an orphan blob is deleted
ARTIFACT_GC_DRY_RUNnofalseLog what would be GC’d without deleting

§Examples

use ironflow_api::config::ServerConfig;

let config = ServerConfig::from_env()?;
println!("Listening on port {}", config.port);

Structs§

ConfigError
Configuration validation error.
ServerConfig
Server configuration loaded from environment variables.