refactor: 整理项目根目录结构
整理内容: - 删除 60+ 临时测试输出文件 (*.txt) - 移动二进制文件到 bin/ 目录 - 移动 Shell 脚本到 scripts/ 目录 - scripts/dev/: check_gitea.sh, check_sub2api.sh, run_tests.sh - scripts/deploy/: deploy_*.sh, simple_deploy.sh - scripts/ops/: fix_nginx.sh, fix_ssl.sh, install_docker.sh - scripts/test/: test_*.sh, test_*.bat - 移动批处理文件到 scripts/ - 移动 Python 脚本到 tools/ - 清理临时日志文件 保留根目录必要文件: - go.mod, go.sum, go.work - Makefile, docker-compose.yml - .env.example, .gitignore - README.md, AGENTS.md, DEPLOY_GUIDE.md 验证: go build ./... && go test ./... 通过
This commit is contained in:
99
.env.example
Normal file
99
.env.example
Normal file
@@ -0,0 +1,99 @@
|
||||
# =============================================================================
|
||||
# UMS 环境变量配置模板
|
||||
# 复制本文件为 .env(不要提交 .env 到 git),填入真实值后启动服务
|
||||
# =============================================================================
|
||||
|
||||
# -------------------------------------
|
||||
# 数据库
|
||||
# -------------------------------------
|
||||
# 数据库文件路径(SQLite,留空则默认 ./data/user_management.db)
|
||||
DATABASE_PATH=./data/user_management.db
|
||||
|
||||
# -------------------------------------
|
||||
# JWT 密钥(生产环境必须替换为随机强密钥)
|
||||
# 生成命令:openssl rand -hex 32
|
||||
# -------------------------------------
|
||||
JWT_SECRET=<your-jwt-secret-here>
|
||||
JWT_REFRESH_SECRET=<your-refresh-secret-here>
|
||||
|
||||
# -------------------------------------
|
||||
# 默认管理员账号(首次启动 bootstrap 使用)
|
||||
# -------------------------------------
|
||||
DEFAULT_ADMIN_EMAIL=admin@example.com
|
||||
DEFAULT_ADMIN_PASSWORD=<strong-password-here>
|
||||
|
||||
# -------------------------------------
|
||||
# 邮件服务(SMTP)
|
||||
# -------------------------------------
|
||||
SMTP_HOST=smtp.example.com
|
||||
SMTP_PORT=587
|
||||
SMTP_USERNAME=noreply@example.com
|
||||
SMTP_PASSWORD=<smtp-password-here>
|
||||
SMTP_FROM=noreply@example.com
|
||||
|
||||
# -------------------------------------
|
||||
# 短信服务(可选,留空则禁用短信功能)
|
||||
# -------------------------------------
|
||||
SMS_PROVIDER=tencent # tencent | aliyun
|
||||
SMS_SECRET_ID=<secret-id>
|
||||
SMS_SECRET_KEY=<secret-key>
|
||||
SMS_APP_ID=<sms-app-id>
|
||||
SMS_SIGN_NAME=<sms-sign-name>
|
||||
SMS_TEMPLATE_CODE=<template-code>
|
||||
|
||||
# -------------------------------------
|
||||
# Alertmanager 告警通道(CRIT-04 / WARN-03)
|
||||
# 配置飞书机器人 Webhook 地址
|
||||
# 获取方式:飞书群 → 群设置 → 机器人 → 添加机器人 → 自定义机器人 → 复制 Webhook 地址
|
||||
# -------------------------------------
|
||||
|
||||
# Critical(P0)告警 Webhook(建议单独频道,24x7 On-Call 值守)
|
||||
FEISHU_WEBHOOK_URL_CRITICAL=https://open.feishu.cn/open-apis/bot/v2/hook/<your-token-critical>
|
||||
|
||||
# Warning(P1)告警 Webhook
|
||||
FEISHU_WEBHOOK_URL_WARNING=https://open.feishu.cn/open-apis/bot/v2/hook/<your-token-warning>
|
||||
|
||||
# Info(P2)告警 Webhook(可与 Warning 共用同一频道)
|
||||
FEISHU_WEBHOOK_URL_INFO=https://open.feishu.cn/open-apis/bot/v2/hook/<your-token-info>
|
||||
|
||||
# 飞书机器人签名密钥(如果开启了签名校验,填入 Secret;否则留空)
|
||||
FEISHU_WEBHOOK_SECRET=
|
||||
|
||||
# Alertmanager 邮件配置(兜底通道)
|
||||
ALERTMANAGER_FROM=alerts@example.com
|
||||
ALERTMANAGER_DEFAULT_TO=ops-team@example.com
|
||||
ALERTMANAGER_CRITICAL_TO=oncall@example.com
|
||||
ALERTMANAGER_SMARTHOST=smtp.example.com:587
|
||||
ALERTMANAGER_AUTH_USERNAME=alerts@example.com
|
||||
ALERTMANAGER_AUTH_PASSWORD=<smtp-password-here>
|
||||
|
||||
# -------------------------------------
|
||||
# Prometheus 抓取配置(如果使用 Prometheus 监控)
|
||||
# /metrics 端点仅允许内网访问(WARN-01 修复)
|
||||
# Prometheus 服务器必须部署在同一内网
|
||||
# -------------------------------------
|
||||
# PROMETHEUS_SCRAPE_INTERVAL=15s (在 prometheus.yml 中配置)
|
||||
|
||||
# -------------------------------------
|
||||
# 服务器配置
|
||||
# -------------------------------------
|
||||
SERVER_PORT=8080
|
||||
SERVER_HOST=0.0.0.0
|
||||
GIN_MODE=release # debug | release | test
|
||||
|
||||
# -------------------------------------
|
||||
# 安全配置
|
||||
# -------------------------------------
|
||||
# CORS 允许的来源(生产环境填实际域名)
|
||||
CORS_ALLOWED_ORIGINS=https://yourdomain.com
|
||||
|
||||
# =============================================================================
|
||||
# 飞书 Webhook 配置步骤:
|
||||
# 1. 进入飞书群 → 右上角 "…" → 群机器人 → 添加机器人
|
||||
# 2. 选择 "自定义机器人" → 填写机器人名称(如 "UMS告警-Critical")
|
||||
# 3. 选择是否开启 "加签" 安全设置(推荐开启,Secret 填入 FEISHU_WEBHOOK_SECRET)
|
||||
# 4. 复制 Webhook 地址填入对应环境变量
|
||||
# 5. 建议创建 3 个机器人分别对应 Critical / Warning / Info 三个频道
|
||||
# 6. 渲染 alertmanager.yml 模板:
|
||||
# envsubst < deployment/alertmanager/alertmanager.yml > /etc/alertmanager/alertmanager.yml
|
||||
# =============================================================================
|
||||
Reference in New Issue
Block a user