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:
| Extension | Format |
|---|---|
.toml | TOML |
.yaml / .yml | YAML |
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
| Struct | Field | Description |
|---|---|---|
SmtpServerConfig | smtp | Listening addresses, TLS ports, rate limits |
ImapServerConfig | imap | IMAP4rev1 listener |
JmapServerConfig | jmap | JMAP HTTP listener |
Pop3ServerConfig | pop3 | POP3 listener |
StorageConfig | storage | Filesystem, Postgres, or AmateRS backend |
AuthConfig | auth | File, LDAP, SQL, or OAuth2 auth backend config |
QueueConfig | queue | Retry queue with exponential back-off |
SecurityConfig | security | Relay networks, blocked IPs |
DomainsConfig | domains | Local domains and address aliases |
MetricsConfig | metrics | Prometheus scrape endpoint |
TracingConfig | tracing | OpenTelemetry OTLP exporter |
ConnectionLimitsConfig | connection_limits | Per-IP and global connection caps |
LoggingConfig | logging | Log 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§
- Connection
Limits Config - Connection limits configuration
- Domains
Config - Domains configuration
- File
Auth Config - File-based authentication configuration
- Imap
Server Config - IMAP server configuration
- Jmap
Server Config - JMAP server configuration
- Ldap
Auth Config - LDAP authentication configuration
- LogFile
Config - Log file configuration
- Logging
Config - Logging configuration
- Mailet
Config - Mailet configuration
- Metrics
Config - Metrics configuration
- OAuth2
Auth Config - OAuth2 authentication configuration
- Pop3
Server Config - POP3 server configuration
- Processor
Config - Processor chain configuration
- Queue
Config - Queue configuration
- Rate
Limit Config - Rate limiting configuration
- Relay
Config - SMTP Relay configuration for outbound mail
- Security
Config - Security configuration
- Server
Config - Main server configuration
- Smtp
Server Config - SMTP server configuration
- SqlAuth
Config - SQL authentication configuration
- Tracing
Config - OpenTelemetry tracing configuration
Enums§
- Auth
Config - Authentication backend configuration
- Otlp
Protocol - OTLP protocol type
- Storage
Config - Storage backend configuration