forked from datawhale/whale-town-end
WARNING: This commit contains code with significant issues that need immediate attention: 1. Type Safety Issues: - Unused import ZulipAccountsService causing compilation warnings - Implicit 'any' type in formatZulipAccount method parameter - Type inconsistencies in service injections 2. Service Integration Problems: - Inconsistent service interface usage - Missing proper type definitions for injected services - Potential runtime errors due to type mismatches 3. Code Quality Issues: - Violation of TypeScript strict mode requirements - Inconsistent error handling patterns - Missing proper interface implementations Files affected: - src/business/admin/database_management.service.ts (main issue) - Multiple test files and service implementations - Configuration and documentation updates Next steps required: 1. Fix TypeScript compilation errors 2. Implement proper type safety 3. Resolve service injection inconsistencies 4. Add comprehensive error handling 5. Update tests to match new implementations Impact: High - affects admin functionality and system stability Priority: Urgent - requires immediate review and fixes Author: moyin Date: 2026-01-10
142 lines
4.2 KiB
Plaintext
142 lines
4.2 KiB
Plaintext
# 环境配置模板
|
||
# 复制此文件为 .env 并根据需要修改配置
|
||
|
||
# ===========================================
|
||
# 测试模式配置(开发/测试环境推荐)
|
||
# ===========================================
|
||
# 使用以下配置可以在没有数据库和邮件服务器的情况下进行测试
|
||
# 1. 复制此文件为 .env
|
||
# 2. 保持数据库和邮件配置为注释状态
|
||
# 3. 运行 npm run dev 启动服务
|
||
# 4. 运行测试脚本:./test-api.ps1 (Windows) 或 ./test-api.sh (Linux/macOS)
|
||
|
||
# 应用配置
|
||
NODE_ENV=development
|
||
PORT=3000
|
||
LOG_LEVEL=debug
|
||
|
||
# ===========================================
|
||
# 测试用户配置
|
||
# ===========================================
|
||
# 用于测试邮箱冲突逻辑的真实用户
|
||
TEST_USER_EMAIL=your_test_email@example.com
|
||
TEST_USER_USERNAME=your_test_username
|
||
TEST_USER_PASSWORD=your_test_password
|
||
TEST_USER_NICKNAME=测试用户
|
||
|
||
# ===========================================
|
||
# 管理员后台配置(开发环境推荐配置)
|
||
# ===========================================
|
||
# 管理员Token签名密钥(至少16字符,生产环境务必使用强随机值)
|
||
ADMIN_TOKEN_SECRET=dev_admin_token_secret_change_me_32chars
|
||
# 管理员Token有效期(秒),默认8小时
|
||
ADMIN_TOKEN_TTL_SECONDS=28800
|
||
|
||
# 启动引导创建管理员账号(仅当 enabled=true 时生效)
|
||
ADMIN_BOOTSTRAP_ENABLED=true
|
||
ADMIN_USERNAME=admin
|
||
ADMIN_PASSWORD=Admin123456
|
||
ADMIN_NICKNAME=管理员
|
||
|
||
# JWT 配置
|
||
JWT_SECRET=test_jwt_secret_key_for_development_only_32chars
|
||
JWT_EXPIRES_IN=7d
|
||
|
||
# Redis 配置(测试模式:使用文件存储)
|
||
USE_FILE_REDIS=true
|
||
REDIS_HOST=localhost
|
||
REDIS_PORT=6379
|
||
REDIS_PASSWORD=
|
||
REDIS_DB=0
|
||
|
||
# ===========================================
|
||
# 生产环境配置(取消注释并填入真实数据)
|
||
# ===========================================
|
||
|
||
# 数据库配置(生产环境取消注释)
|
||
DB_HOST=your_mysql_host
|
||
DB_PORT=3306
|
||
DB_USERNAME=your_db_username
|
||
DB_PASSWORD=your_db_password
|
||
DB_NAME=your_db_name
|
||
|
||
# Redis 配置(生产环境取消注释并设置 USE_FILE_REDIS=false)
|
||
# USE_FILE_REDIS=false
|
||
# REDIS_HOST=your_redis_host
|
||
# REDIS_PORT=6379
|
||
# REDIS_PASSWORD=your_redis_password
|
||
# REDIS_DB=0
|
||
|
||
# 邮件服务配置(生产环境取消注释)
|
||
EMAIL_HOST=smtp.163.com
|
||
EMAIL_PORT=465
|
||
EMAIL_SECURE=true
|
||
EMAIL_USER=your_email@163.com
|
||
EMAIL_PASS=your_email_app_password
|
||
EMAIL_FROM="whaletown <your_email@163.com>"
|
||
|
||
# 生产环境设置(生产环境取消注释)
|
||
# NODE_ENV=production
|
||
# LOG_LEVEL=info
|
||
|
||
# ===========================================
|
||
# Zulip 集成配置
|
||
# ===========================================
|
||
|
||
# Zulip 配置模式
|
||
# static: 使用静态配置文件 (config/zulip/map-config.json)
|
||
# dynamic: 从Zulip服务器动态获取Stream作为地图
|
||
# hybrid: 混合模式,优先动态,回退静态 (推荐)
|
||
ZULIP_CONFIG_MODE=hybrid
|
||
|
||
# Zulip 服务器配置
|
||
ZULIP_SERVER_URL=https://your-zulip-server.com/
|
||
ZULIP_BOT_EMAIL=your-bot@your-zulip-server.com
|
||
ZULIP_BOT_API_KEY=your_bot_api_key
|
||
|
||
# Zulip API Key加密密钥(生产环境必须配置,至少32字符)
|
||
ZULIP_API_KEY_ENCRYPTION_KEY=your_32_character_encryption_key_here
|
||
|
||
# Zulip 错误处理配置
|
||
ZULIP_DEGRADED_MODE_ENABLED=false
|
||
ZULIP_AUTO_RECONNECT_ENABLED=true
|
||
ZULIP_MAX_RECONNECT_ATTEMPTS=5
|
||
ZULIP_RECONNECT_BASE_DELAY=5000
|
||
ZULIP_API_TIMEOUT=30000
|
||
ZULIP_MAX_RETRIES=3
|
||
|
||
# Zulip 连接限制配置
|
||
ZULIP_MAX_CONNECTIONS=100
|
||
ZULIP_SESSION_TIMEOUT=30
|
||
ZULIP_CLEANUP_INTERVAL=5
|
||
|
||
# Zulip 消息配置
|
||
ZULIP_MESSAGE_RATE_LIMIT=10
|
||
ZULIP_MESSAGE_MAX_LENGTH=10000
|
||
ZULIP_CONTENT_FILTER_ENABLED=true
|
||
# ZULIP_SENSITIVE_WORDS_PATH=config/zulip/sensitive-words.txt
|
||
|
||
# Zulip 允许的Stream列表(逗号分隔,空表示允许所有)
|
||
# ZULIP_ALLOWED_STREAMS=General,Novice Village,Tavern
|
||
|
||
# WebSocket配置
|
||
# WEBSOCKET_PORT=3000
|
||
# WEBSOCKET_NAMESPACE=/game
|
||
# WEBSOCKET_PING_INTERVAL=25000
|
||
# WEBSOCKET_PING_TIMEOUT=5000
|
||
|
||
# ===========================================
|
||
# 监控配置
|
||
# ===========================================
|
||
|
||
# 健康检查间隔(毫秒)
|
||
MONITORING_HEALTH_CHECK_INTERVAL=60000
|
||
|
||
# 错误率阈值(0-1)
|
||
MONITORING_ERROR_RATE_THRESHOLD=0.1
|
||
|
||
# API响应时间阈值(毫秒)
|
||
MONITORING_RESPONSE_TIME_THRESHOLD=5000
|
||
|
||
# 内存使用阈值(0-1)
|
||
MONITORING_MEMORY_THRESHOLD=0.9 |