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);

Re-exports§

pub use performance::PerformanceConfig;
pub use tls::ClientAuthMode;
pub use tls::ProtocolKind;
pub use tls::TlsConfig;
pub use tls::TlsEndpointConfig;

Modules§

logging
Structured logging with file rotation for RusMES
performance
Performance tuning configuration for RusMES.
tls
Per-protocol TLS certificate configuration for RusMES.

Structs§

ConnectionLimitsConfig
Connection limits configuration.
DomainsConfig
Local domain and address alias configuration.
FileAuthConfig
File-based authentication configuration.
ImapServerConfig
IMAP4rev1 server listener configuration.
JmapPushConfig
JMAP WebPush delivery configuration (RFC 8030 + RFC 8444 VAPID).
JmapServerConfig
JMAP over HTTP server listener configuration.
LdapAuthConfig
LDAP authentication configuration.
LogFileConfig
Log file rotation configuration.
LoggingConfig
Structured logging configuration.
MailetConfig
A single matcher + mailet rule within a processor chain.
MetricsBasicAuthConfig
Optional HTTP Basic authentication for the metrics scrape endpoint.
MetricsConfig
Prometheus metrics scrape endpoint configuration.
OAuth2AuthConfig
OAuth2 authentication configuration.
Pop3ServerConfig
POP3 server listener configuration.
ProcessorConfig
A named processor chain containing an ordered list of mailets.
QueueConfig
Outbound mail queue and retry configuration.
RateLimitConfig
Per-IP SMTP rate limiting parameters.
RelayConfig
Outbound SMTP relay (“smart-host”) configuration.
SecurityConfig
Inbound relay and IP-filtering security configuration.
ServerConfig
Main server configuration.
SmtpOutboundConfig
Configuration for outbound SMTP connection pooling.
SmtpServerConfig
SMTP server listener configuration.
SqlAuthConfig
SQL authentication configuration.
TracingConfig
OpenTelemetry OTLP distributed tracing configuration.

Enums§

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