rusmes-config
Configuration management for RusMES. Loads and validates TOML and YAML configuration files, providing strongly-typed config structs to all server components.
Status
Complete. Supports loading ServerConfig from both TOML and YAML files with all major configuration sections.
Configuration Structs
| Struct | Description |
|---|---|
ServerConfig |
Top-level: domain, postmaster, sub-configs |
SmtpServerConfig |
SMTP host, port, TLS, auth, message size |
ImapServerConfig |
IMAP host, port, TLS |
JmapServerConfig |
JMAP host, port, base URL |
StorageConfig |
Backend selection (filesystem / postgres / amaters) |
ProcessorConfig |
Mailet processor chain definition |
MailetConfig |
Individual mailet with matcher, name, and params |
Storage Backend Variants
Size Parser
Parses human-readable sizes: "50MB", "1GB", "1024KB", "1024" (bytes).
Usage
use ServerConfig;
// Load TOML configuration
let config = from_file?;
println!;
println!;
println!;
// Load YAML configuration
let config = from_file?;
// ... same API
The format is auto-detected based on file extension:
.tomlfiles are parsed as TOML.yamlor.ymlfiles are parsed as YAML
Example Configuration
See examples/ directory for minimal, full reference, and production configurations in both TOML and YAML formats:
rusmes-minimal.toml/rusmes-minimal.yamlrusmes-full.toml/rusmes-full.yamlrusmes-production.toml
Dependencies
rusmes-proto-MailAddresstypeserde- deserializationtoml- TOML parsingserde_yaml- YAML parsinganyhow- error handling
Tests
Tests cover: size string parsing, duration string parsing, TOML configuration deserialization, YAML configuration deserialization, and TOML/YAML equivalence.