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_SECRETproddev defaultJWT signing secret
WORKER_TOKENproddev defaultWorker-to-API auth token
PORTno3000HTTP listen port
ALLOWED_ORIGINSnosame-originComma-separated CORS origins
DASHBOARD_DIRnoembeddedFilesystem path to dashboard assets
WEBHOOK_URLno-Outbound webhook URL for notifications
IRONFLOW_ENVnodevelopmentproduction or development
RATE_LIMIT_AUTHno10Auth rate limit (req/min/IP). 0 = disabled
RATE_LIMIT_GENERALno60General rate limit (req/min/IP). 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)
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.