pub struct Config {
pub target_emails: Vec<String>,
pub webhook_url: String,
pub smtp_bind_address: String,
pub smtp_port: u16,
pub health_check_bind_address: String,
pub health_check_port: u16,
}Expand description
Holds the application’s runtime configuration settings.
These settings are typically loaded from environment variables via from_env.
Fields§
§target_emails: Vec<String>The list of email addresses MailLaser will accept mail for. (Required: MAIL_LASER_TARGET_EMAILS, comma-separated)
webhook_url: StringThe URL where the extracted email payload will be sent via POST request. (Required: MAIL_LASER_WEBHOOK_URL)
smtp_bind_address: StringThe IP address the SMTP server should listen on. (Optional: MAIL_LASER_BIND_ADDRESS, Default: “0.0.0.0”)
smtp_port: u16The network port the SMTP server should listen on. (Optional: MAIL_LASER_PORT, Default: 2525)
health_check_bind_address: StringThe IP address the health check HTTP server should listen on. (Optional: MAIL_LASER_HEALTH_BIND_ADDRESS, Default: “0.0.0.0”)
health_check_port: u16The network port the health check HTTP server should listen on. (Optional: MAIL_LASER_HEALTH_PORT, Default: 8080)
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Loads configuration settings from environment variables.
Reads variables prefixed with MAIL_LASER_. Supports loading from a .env file
if present. Provides default values for bind addresses and ports if not specified.
Logs the configuration values being used.
§Errors
Returns an Err if:
- Required environment variables (
MAIL_LASER_TARGET_EMAILS,MAIL_LASER_WEBHOOK_URL) are missing orMAIL_LASER_TARGET_EMAILSis empty/invalid. - Optional port variables (
MAIL_LASER_PORT,MAIL_LASER_HEALTH_PORT) are set but cannot be parsed asu16.