Skip to content

دليل التكوين

يستخدم 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 = 993

تكوين TLS

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]
# الحد الأقصى لرسائل البريد الإلكتروني في الساعة
max_emails_per_hour = 100

# الحد الأقصى للاتصالات في الدقيقة
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

مزيد من المعلومات:

Released under the GPL 3.0 License.