admin-config 0.1.0

easy for server config
Documentation
# Actix Admin Server 配置文件示例
# 复制此文件为 config.toml 并修改相应的配置项

# ==================== 服务器配置 ====================
[server]
name = "actix-admin-server"
version = "0.1.0"
# 服务器监听端口(可通过环境变量 PORT 覆盖)
port = 3400
# 服务器监听地址
host = "0.0.0.0"
# 日志级别: trace, debug, info, warn, error
log_level = "info"

# ==================== 数据库配置 ====================

# MongoDB 配置(必填)
[database.mongodb]
host = "localhost"
port = 27017
database = "admin_db"
username = "mongouser"
password = "your_password"
max_pool_size = 10
connect_timeout = 10

# MySQL 配置(可选)
[database.mysql]
host = "localhost"
port = 3306
database = "admin_db"
username = "root"
password = "your_password"
max_pool_size = 10
connect_timeout = 10

# ==================== Redis 配置 ====================
[redis]
host = "localhost"
port = 6379
username = "default"
password = "your_password"
database = 0
max_pool_size = 20
connect_timeout = 5

# ==================== JWT 认证配置 ====================
[auth]
# JWT Token 密钥(生产环境请使用强密码,至少 32 字符)
token_secret = "change_this_to_a_strong_secret_in_production"
# Token 过期时间(小时)
token_expiry_hours = 24
# Refresh Token 过期时间(天)
refresh_token_expiry_days = 7

# ==================== 邮件服务配置 ====================
[email]
# SMTP 服务器地址
smtp_host = "smtp.gmail.com"
# SMTP 端口(Gmail: 587, QQ邮箱: 587, 163邮箱: 465)
smtp_port = 587
# SMTP 用户名(通常是完整的邮箱地址)
smtp_username = "your-email@gmail.com"
# SMTP 密码(Gmail 需要使用应用专用密码)
smtp_password = "your_app_password"
# 发件人名称
from_name = "系统通知"
# 发件人邮箱
from_email = "your-email@gmail.com"
# 是否启用 TLS
enable_tls = true

# ==================== 短信服务配置 ====================
[sms]
# 短信服务商(tencent/aliyun)
provider = "tencent"
# 短信应用 ID
app_id = "your_app_id"
# 短信应用 Key/Secret
app_key = "your_app_key"
# 短信签名
sign_name = "您的应用"
# 验证码模板 ID
template_id = "123456"

# 腾讯云短信配置
[sms.tencent]
sdk_app_id = "1400000000"
secret_id = "AKIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
secret_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
region = "ap-guangzhou"

# 阿里云短信配置
[sms.aliyun]
access_key_id = "LTAI5xxxxxxxxxxxxx"
access_key_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
region = "cn-hangzhou"

# ==================== 验证码配置 ====================
[verification_code]
# 验证码长度(位数)
length = 6
# 验证码有效期(秒,300秒 = 5分钟)
ttl = 300
# 发送间隔限制(秒,60秒 = 1分钟)
send_interval = 60

# ==================== 对象存储配置(腾讯云 COS)====================
[storage.cos]
# SecretId
secret_id = "AKIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# SecretKey
secret_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# 存储桶名称
bucket = "your-bucket-1234567890"
# 地域
region = "ap-guangzhou"
# CDN 加速域名(可选)
cdn_domain = "cdn.example.com"

# ==================== 安全配置 ====================
[security]
# AES 加密密钥(32字节,64位十六进制)
aes_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# AES 初始化向量(16字节,32位十六进制)
aes_iv = "0123456789abcdef0123456789abcdef"
# 是否启用 CORS
enable_cors = true
# 允许的来源(多个用逗号分隔,* 表示允许所有)
allowed_origins = "http://localhost:3000,https://example.com"
# 是否启用 CSRF 保护
enable_csrf = false

# ==================== 会话配置 ====================
[session]
# 会话密钥(生产环境请使用强密码)
secret_key = "change_this_session_secret_key_in_production"
# 会话过期时间(秒,86400秒 = 24小时)
max_age = 86400
# 是否使用 HttpOnly Cookie
http_only = true
# 是否使用 Secure Cookie(生产环境建议启用,需要 HTTPS)
secure = false
# Cookie 路径
cookie_path = "/"
# Cookie 域名(可选,留空表示使用当前域名)
cookie_domain = ""

# ==================== 文件上传配置 ====================
[upload]
# 允许的文件类型(MIME 类型,多个用逗号分隔)
allowed_types = "image/jpeg,image/png,image/gif,image/webp,application/pdf"
# 单文件最大大小(MB)
max_file_size = 10
# 上传目录
upload_dir = "./uploads"
# 临时目录
temp_dir = "./temp"

# ==================== 限流配置 ====================
[rate_limit]
# 是否启用限流
enabled = true
# 每个 IP 每分钟最大请求数
requests_per_minute = 60
# 突发流量允许的额外请求数
burst_size = 10

# ==================== 开发模式配置 ====================
[development]
# 是否启用开发模式
enabled = false
# 是否输出调试信息
debug = false
# 是否启用热重载
hot_reload = false
# 是否显示详细错误信息
show_error_details = true