Configuration Guide
SirrChat uses TOML format configuration files to provide flexible and readable configuration options.
Configuration File Location
Default configuration file paths:
- Linux:
~/.sirrchatd/config.toml - Custom path: Use
--configparameter to specify
Basic Configuration
Server Configuration
toml
[server]
# Server hostname
hostname = "mail.example.com"
# SMTP ports
smtp_port = 25
submission_port = 587
# IMAP ports
imap_port = 143
imaps_port = 993TLS Configuration
toml
[tls]
# Automatically obtain Let's Encrypt certificate
acme = true
# DNS provider (for DNS-01 validation)
dns_provider = "cloudflare"
# Cloudflare API token
[tls.cloudflare]
api_token = "your-cloudflare-api-token"Database Configuration
toml
[database]
# Database type: sqlite, postgres, mysql
type = "postgres"
# PostgreSQL connection string
dsn = "postgresql://user:password@localhost/sirrchat"Storage Configuration
toml
[storage]
# Storage type: local, s3
type = "local"
# Local storage path
local_path = "/var/mail"
# S3 configuration (if using S3)
[storage.s3]
endpoint = "s3.amazonaws.com"
bucket = "sirrchat-storage"
access_key = "your-access-key"
secret_key = "your-secret-key"Authentication Configuration
Blockchain Authentication
toml
[auth.blockchain]
enabled = true
# Supported blockchain networks
networks = ["ethereum", "bsc", "polygon"]
# RPC endpoints
[auth.blockchain.rpc]
ethereum = "https://mainnet.infura.io/v3/YOUR-PROJECT-ID"
bsc = "https://bsc-dataseed.binance.org"LDAP Authentication
toml
[auth.ldap]
enabled = true
server = "ldap://ldap.example.com:389"
bind_dn = "cn=admin,dc=example,dc=com"
bind_password = "password"
user_base = "ou=users,dc=example,dc=com"Security Configuration
DKIM Configuration
toml
[dkim]
enabled = true
selector = "default"
private_key_path = "/etc/sirrchatd/dkim/private.key"SPF Configuration
toml
[spf]
enabled = true
check_incoming = trueRate Limiting
toml
[rate_limit]
# Maximum emails per hour
max_emails_per_hour = 100
# Maximum connections per minute
max_connections_per_minute = 10Logging Configuration
toml
[logging]
# Log level: debug, info, warn, error
level = "info"
# Log format: text, json
format = "json"
# Log output
output = "/var/log/sirrchatd/app.log"Advanced Configuration
Performance Tuning
toml
[performance]
# Number of worker threads
workers = 4
# Database connection pool size
db_pool_size = 10
# Cache size (MB)
cache_size = 256Monitoring Configuration
toml
[monitoring]
# Prometheus metrics endpoint
metrics_enabled = true
metrics_port = 9090
# Health check endpoint
health_check_port = 8080Complete Configuration Example
toml
[server]
hostname = "mail.example.com"
smtp_port = 25
submission_port = 587
imap_port = 143
imaps_port = 993
[tls]
acme = true
dns_provider = "cloudflare"
[tls.cloudflare]
api_token = "your-cloudflare-api-token"
[database]
type = "postgres"
dsn = "postgresql://sirrchat:password@localhost/sirrchat"
[storage]
type = "local"
local_path = "/var/mail"
[auth.blockchain]
enabled = true
networks = ["ethereum", "bsc"]
[auth.blockchain.rpc]
ethereum = "https://mainnet.infura.io/v3/YOUR-PROJECT-ID"
bsc = "https://bsc-dataseed.binance.org"
[dkim]
enabled = true
selector = "default"
private_key_path = "/etc/sirrchatd/dkim/private.key"
[logging]
level = "info"
format = "json"
output = "/var/log/sirrchatd/app.log"Configuration Validation
Verify configuration before startup:
bash
sirrchatd config verifyEnvironment Variables
All configurations can be overridden by environment variables:
bash
export SIRRCHAT_SERVER_HOSTNAME=mail.example.com
export SIRRCHAT_DATABASE_DSN=postgresql://user:pass@localhost/dbMore information: