pub struct ServerConfig {Show 16 fields
pub database_url: Option<String>,
pub jwt_secret: String,
pub worker_token: String,
pub port: u16,
pub allowed_origins: Option<String>,
pub dashboard_dir: Option<PathBuf>,
pub webhook_url: Option<String>,
pub artifacts_dir: Option<PathBuf>,
pub artifact_max_bytes: u64,
pub purge_max_age_days: u32,
pub purge_max_runs_per_workflow: u32,
pub purge_dry_run: bool,
pub purge_interval_secs: u64,
pub is_production: bool,
pub rate_limit_auth: Option<u32>,
pub rate_limit_general: Option<u32>,
}Expand description
Server configuration loaded from environment variables.
Use ServerConfig::from_env to load and validate at startup.
§Examples
use ironflow_api::config::ServerConfig;
let config = ServerConfig::from_env()?;
assert!(config.port > 0);Fields§
§database_url: Option<String>PostgreSQL connection string. Required in production.
jwt_secret: StringJWT signing secret.
worker_token: StringWorker-to-API authentication token.
port: u16HTTP listen port.
allowed_origins: Option<String>Comma-separated list of allowed CORS origins.
dashboard_dir: Option<PathBuf>Filesystem path to dashboard assets (overrides embedded).
webhook_url: Option<String>Outbound webhook URL for event notifications.
artifacts_dir: Option<PathBuf>Filesystem root for artifact blobs.
None leaves artifacts disabled: the artifact routes answer 501 and
a step that declares one fails explicitly. Every other endpoint is
unaffected, so an existing deployment upgrades without changes.
Read from ARTIFACTS_DIR.
artifact_max_bytes: u64Maximum size of a single artifact, in bytes.
Read from ARTIFACT_MAX_BYTES, defaulting to 100 MiB.
purge_max_age_days: u32Maximum age of a run before it becomes eligible for purging, in days.
Read from PURGE_MAX_AGE_DAYS, defaulting to 90.
purge_max_runs_per_workflow: u32Maximum number of terminal runs to keep per workflow.
Read from PURGE_MAX_RUNS_PER_WORKFLOW, defaulting to 1000.
purge_dry_run: boolWhen true, the purger logs what would be deleted but does not delete.
Read from PURGE_DRY_RUN, defaulting to false.
purge_interval_secs: u64Interval between purge ticks, in seconds.
Read from PURGE_INTERVAL_SECS, defaulting to 86400 (once per day).
is_production: boolWhether the server is running in production mode.
rate_limit_auth: Option<u32>Rate limit for auth credential routes (sign-in, sign-up) in requests
per minute per IP. None disables rate limiting on these routes.
rate_limit_general: Option<u32>Rate limit for general public API routes in requests per minute per IP.
None disables rate limiting on these routes.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn from_env() -> Result<Self, ConfigError>
pub fn from_env() -> Result<Self, ConfigError>
Load configuration from environment variables and validate.
In production mode (IRONFLOW_ENV=production), JWT_SECRET and
WORKER_TOKEN must be explicitly set (dev defaults are rejected).
DATABASE_URL is required in production.
In development mode, insecure defaults are used with a warning.
§Errors
Returns ConfigError with all validation failures collected,
so the operator can fix everything in one pass.
§Examples
use ironflow_api::config::ServerConfig;
let config = ServerConfig::from_env()?;Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more