Skip to content

Configuration

Mailman uses Figment for layered configuration. Values are resolved in order (last wins):

  1. Compiled defaults — sensible defaults for local development
  2. TOML fileconfig/default.toml (optional)
  3. Environment variables — prefixed with MAILMAN_, nested with __

Environment Variables

All config is set via MAILMAN_ prefixed environment variables. Nesting uses double underscore (__).

Required

VariableDefaultDescription
MAILMAN_DATABASE__URLpostgres://localhost/mailmanPostgreSQL connection string

HTTP

VariableDefaultDescription
MAILMAN_HTTP__BIND_ADDR0.0.0.0:8080API server bind address

Logging

VariableDefaultDescription
MAILMAN_LOGGING__FORMATjsonjson, pretty, or compact
RUST_LOGinfotracing log level filter

TIP

Use MAILMAN_LOGGING__FORMAT=pretty for local development — it gives you human-readable colored output instead of JSON.

AWS

VariableDefaultDescription
MAILMAN_AWS__REGIONAuto-detectAWS region (e.g., us-east-1)

S3

VariableDefaultDescription
MAILMAN_S3__RAW_EMAIL_BUCKETmailman-rawBucket for raw MIME storage
MAILMAN_S3__ATTACHMENTS_BUCKETmailman-attachmentsBucket for attachment files

SQS

VariableDefaultDescription
MAILMAN_SQS__INBOUND_QUEUE_URL(empty)Inbound processing queue URL
MAILMAN_SQS__OUTBOUND_QUEUE_URL(empty)Outbound delivery queue URL
MAILMAN_SQS__TELEMETRY_QUEUE_URL(empty)SES event notification queue URL

Redis

VariableDefaultDescription
MAILMAN_REDIS__URL(none)Redis URL for volume rate limiting. If unset, volume limiting is disabled.

ClamAV

VariableDefaultDescription
MAILMAN_SCAN__CLAMAV_HOST(none)ClamAV daemon hostname. If unset, scanning is skipped (noop).
MAILMAN_SCAN__CLAMAV_PORT(none)ClamAV daemon port (typically 3310)

Config Struct

The full config structure is defined in crates/config/src/lib.rs:

rust
pub struct AppConfig {
    pub logging: LoggingConfig,  // format
    pub http: HttpConfig,        // bind_addr
    pub aws: AwsConfig,          // region
    pub database: DatabaseConfig,// url
    pub redis: RedisConfig,      // url
    pub s3: S3Config,            // raw_email_bucket, attachments_bucket
    pub sqs: SqsConfig,         // inbound/outbound/telemetry queue URLs
    pub scan: ScanConfig,        // clamav_host, clamav_port
}

Minimal Local .env

For local API development, you only need:

bash
DATABASE_URL=postgres://postgres:mailman@localhost:5433/mailman
MAILMAN_LOGGING__FORMAT=pretty

The worker needs SQS URLs to function. For local development without AWS, only run the API service.