1.1 补全 docker-compose.yml (PostgreSQL 16 + SaaS 后端容器)
1.2 Migration 系统化:
- provider_keys.max_rpm/max_tpm 改为 BIGINT 匹配 Rust Option<i64>
- 移除 seed_demo_data 中的 ALTER TABLE 运行时修补
- seed 数据绑定类型 i32→i64 对齐列定义
1.3 saas-config.toml 修复:
- 添加 cors_origins (开发环境 localhost)
- 添加 [scheduler] section (注释示例)
- 数据库密码改为开发默认值 + ZCLAW_DATABASE_URL 环境变量覆盖
- 添加配置文档注释 (JWT/TOTP/管理员环境变量)
39 lines
1.2 KiB
TOML
39 lines
1.2 KiB
TOML
# ZCLAW SaaS 配置文件
|
|
# 生产环境请通过环境变量覆盖敏感配置:
|
|
# ZCLAW_DATABASE_URL - 数据库连接字符串 (含密码)
|
|
# ZCLAW_SAAS_JWT_SECRET - JWT 签名密钥
|
|
# ZCLAW_TOTP_ENCRYPTION_KEY - TOTP 加密密钥 (64 字符 hex)
|
|
# ZCLAW_ADMIN_USERNAME / ZCLAW_ADMIN_PASSWORD - 初始管理员账号
|
|
|
|
[server]
|
|
host = "0.0.0.0"
|
|
port = 8080
|
|
# CORS 允许的来源; 开发环境使用 localhost, 生产环境改为实际域名
|
|
cors_origins = ["http://localhost:1420", "http://localhost:5173", "http://localhost:3000"]
|
|
|
|
[database]
|
|
# 开发环境默认值; 生产环境务必设置 ZCLAW_DATABASE_URL 环境变量
|
|
url = "postgres://postgres:postgres@localhost:5432/zclaw"
|
|
|
|
[auth]
|
|
jwt_expiration_hours = 24
|
|
totp_issuer = "ZCLAW SaaS"
|
|
|
|
[relay]
|
|
max_queue_size = 1000
|
|
max_concurrent_per_provider = 5
|
|
batch_window_ms = 50
|
|
retry_delay_ms = 1000
|
|
max_attempts = 3
|
|
|
|
[rate_limit]
|
|
requests_per_minute = 60
|
|
burst = 10
|
|
|
|
[scheduler]
|
|
# 定时任务配置 (可选)
|
|
# jobs = [
|
|
# { name = "cleanup-expired-tokens", interval = "1h", task = "token_cleanup", run_on_start = false },
|
|
# { name = "aggregate-usage-stats", interval = "24h", task = "usage_aggregation", run_on_start = true },
|
|
# ]
|