Skip to main content

Crate rusmes_config

Crate rusmes_config 

Source
Expand description

§rusmes-config

Configuration management for the RusMES mail server.

§Overview

rusmes-config provides the ServerConfig struct and supporting types that model the complete runtime configuration of a RusMES installation. Configuration is normally loaded from a TOML or YAML file on disk, with optional overrides from environment variables (prefix RUSMES_).

§File format auto-detection

ServerConfig::from_file inspects the file extension:

ExtensionFormat
.tomlTOML
.yaml / .ymlYAML

Both formats expose identical semantics; see the crate tests for concrete examples.

§Environment variable overrides

Every significant configuration key has a corresponding RUSMES_* environment variable that takes precedence over the file value. A full list is documented on ServerConfig::apply_env_overrides. This enables twelve-factor-style deployments where the base config is baked into a container image and secrets are injected at runtime.

§Sections

StructFieldDescription
SmtpServerConfigsmtpListening addresses, TLS ports, rate limits
ImapServerConfigimapIMAP4rev1 listener
JmapServerConfigjmapJMAP HTTP listener
Pop3ServerConfigpop3POP3 listener
StorageConfigstorageFilesystem, Postgres, or AmateRS backend
AuthConfigauthFile, LDAP, SQL, or OAuth2 auth backend config
QueueConfigqueueRetry queue with exponential back-off
SecurityConfigsecurityRelay networks, blocked IPs
DomainsConfigdomainsLocal domains and address aliases
MetricsConfigmetricsPrometheus scrape endpoint
TracingConfigtracingOpenTelemetry OTLP exporter
ConnectionLimitsConfigconnection_limitsPer-IP and global connection caps
LoggingConfigloggingLog level / format / output routing

The logging module provides logging::init_logging for initialising the global tracing subscriber from a logging::LogConfig, including file rotation and optional gzip compression of rotated files.

§Validation

ServerConfig::validate is called automatically during ServerConfig::from_file. It checks domain syntax, email addresses, port numbers, storage path accessibility, and processor uniqueness.

§Example

use rusmes_config::ServerConfig;

let cfg = ServerConfig::from_file("/etc/rusmes/rusmes.toml")?;
println!("Serving domain {}", cfg.domain);

Modules§

logging
Structured logging with file rotation for RusMES

Structs§

ConnectionLimitsConfig
Connection limits configuration
DomainsConfig
Domains configuration
FileAuthConfig
File-based authentication configuration
ImapServerConfig
IMAP server configuration
JmapServerConfig
JMAP server configuration
LdapAuthConfig
LDAP authentication configuration
LogFileConfig
Log file configuration
LoggingConfig
Logging configuration
MailetConfig
Mailet configuration
MetricsConfig
Metrics configuration
OAuth2AuthConfig
OAuth2 authentication configuration
Pop3ServerConfig
POP3 server configuration
ProcessorConfig
Processor chain configuration
QueueConfig
Queue configuration
RateLimitConfig
Rate limiting configuration
RelayConfig
SMTP Relay configuration for outbound mail
SecurityConfig
Security configuration
ServerConfig
Main server configuration
SmtpServerConfig
SMTP server configuration
SqlAuthConfig
SQL authentication configuration
TracingConfig
OpenTelemetry tracing configuration

Enums§

AuthConfig
Authentication backend configuration
OtlpProtocol
OTLP protocol type
StorageConfig
Storage backend configuration