pub struct ServerConfig {
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 is_production: bool,
}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.
is_production: boolWhether the server is running in production mode.
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more