設定ガイド
SirrChat は TOML フォーマットの設定ファイルを使用して、柔軟で読みやすい設定オプションを提供します。
設定ファイルの場所
デフォルトの設定ファイルパス:
- Linux:
~/.sirrchatd/config.toml - カスタムパス:
--configパラメータを使用して指定
基本設定
サーバー設定
toml
[server]
# サーバーホスト名
hostname = "mail.example.com"
# SMTP ポート
smtp_port = 25
submission_port = 587
# IMAP ポート
imap_port = 143
imaps_port = 993TLS 設定
toml
[tls]
# Let's Encrypt 証明書を自動取得
acme = true
# DNS プロバイダー(DNS-01 検証用)
dns_provider = "cloudflare"
# Cloudflare API トークン
[tls.cloudflare]
api_token = "your-cloudflare-api-token"データベース設定
toml
[database]
# データベースタイプ: sqlite, postgres, mysql
type = "postgres"
# PostgreSQL 接続文字列
dsn = "postgresql://user:password@localhost/sirrchat"ストレージ設定
toml
[storage]
# ストレージタイプ: local, s3
type = "local"
# ローカルストレージパス
local_path = "/var/mail"
# S3 設定(S3 を使用する場合)
[storage.s3]
endpoint = "s3.amazonaws.com"
bucket = "sirrchat-storage"
access_key = "your-access-key"
secret_key = "your-secret-key"認証設定
ブロックチェーン認証
toml
[auth.blockchain]
enabled = true
# サポートされているブロックチェーンネットワーク
networks = ["ethereum", "bsc", "polygon"]
# RPC エンドポイント
[auth.blockchain.rpc]
ethereum = "https://mainnet.infura.io/v3/YOUR-PROJECT-ID"
bsc = "https://bsc-dataseed.binance.org"LDAP 認証
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"セキュリティ設定
DKIM 設定
toml
[dkim]
enabled = true
selector = "default"
private_key_path = "/etc/sirrchatd/dkim/private.key"SPF 設定
toml
[spf]
enabled = true
check_incoming = trueレート制限
toml
[rate_limit]
# 1時間あたりの最大メール数
max_emails_per_hour = 100
# 1分あたりの最大接続数
max_connections_per_minute = 10ログ設定
toml
[logging]
# ログレベル: debug, info, warn, error
level = "info"
# ログフォーマット: text, json
format = "json"
# ログ出力
output = "/var/log/sirrchatd/app.log"高度な設定
パフォーマンスチューニング
toml
[performance]
# ワーカースレッド数
workers = 4
# データベース接続プールサイズ
db_pool_size = 10
# キャッシュサイズ(MB)
cache_size = 256監視設定
toml
[monitoring]
# Prometheus メトリクスエンドポイント
metrics_enabled = true
metrics_port = 9090
# ヘルスチェックエンドポイント
health_check_port = 8080完全な設定例
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"設定の検証
起動前に設定を確認:
bash
sirrchatd config verify環境変数
すべての設定は環境変数で上書き可能:
bash
export SIRRCHAT_SERVER_HOSTNAME=mail.example.com
export SIRRCHAT_DATABASE_DSN=postgresql://user:pass@localhost/db詳細情報: