feat: 增强SaaS后端功能与安全性
refactor: 重构数据库连接使用PostgreSQL替代SQLite feat(auth): 增加JWT验证的audience和issuer检查 feat(crypto): 添加AES-256-GCM字段加密支持 feat(api): 集成utoipa实现OpenAPI文档 fix(admin): 修复配置项表单验证逻辑 style: 统一代码格式与类型定义 docs: 更新技术栈文档说明PostgreSQL
This commit is contained in:
37
saas-env.example
Normal file
37
saas-env.example
Normal file
@@ -0,0 +1,37 @@
|
||||
# ZCLAW SaaS 后端环境变量配置
|
||||
# 复制此文件为 .env 并填入实际值: cp saas-env.example .env
|
||||
|
||||
# ===================== 必需配置 =====================
|
||||
|
||||
# PostgreSQL 数据库连接 URL
|
||||
# 格式: postgres://user:password@host:5432/zclaw
|
||||
DATABASE_URL=postgres://postgres:your_secure_password@localhost:5432/zclaw
|
||||
|
||||
# JWT 签名密钥 (至少 32 字符的随机字符串)
|
||||
# 生成方式: openssl rand -base64 48
|
||||
ZCLAW_SAAS_JWT_SECRET=your-secure-jwt-secret-at-least-32-chars
|
||||
|
||||
# AES-256-GCM 字段加密密钥 (32 字节 hex 编码,64 字符)
|
||||
# 用于加密数据库中存储的敏感字段 (如 API Key)
|
||||
# 生产环境必须设置,密钥丢失将导致已加密数据无法恢复
|
||||
# 生成方式: openssl rand -hex 32
|
||||
# ZCLAW_SAAS_FIELD_ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
||||
|
||||
# ===================== 可选配置 =====================
|
||||
|
||||
# 配置文件路径 (默认: ./saas-config.toml)
|
||||
# ZCLAW_SAAS_CONFIG=./saas-config.toml
|
||||
|
||||
# 开发模式 (绕过部分安全检查,仅限本地开发使用)
|
||||
# ZCLAW_SAAS_DEV=true
|
||||
|
||||
# ===================== 管理员初始化 =====================
|
||||
|
||||
# 首次启动时自动创建超级管理员账户 (可选)
|
||||
# ZCLAW_ADMIN_USERNAME=admin
|
||||
# ZCLAW_ADMIN_PASSWORD=your-admin-password
|
||||
|
||||
# ===================== 测试配置 =====================
|
||||
|
||||
# 测试用数据库 URL (仅 cargo test 使用)
|
||||
# ZCLAW_TEST_DATABASE_URL=postgres://postgres:your_secure_password@localhost:5432/zclaw_test
|
||||
Reference in New Issue
Block a user