重做配置边界(撤销 9b6bfff 思路):config.example.yml 回归 app/——config.yml 是 core 专属(内含平台密钥/登录 secret),executor/wxbot 一律不挂不读;executor 与 wxbot 接线纯 env(EXECUTOR_URL/EXECUTOR_TOKEN、WXBOT_URL/WXBOT_TOKEN,compose 经根 .env 注入,旧文件段忽略),config.example.yml 两段随之删除;wxbot 日志等级改 env WXBOT_LOG_LEVEL(compose 注入,同 EXECUTOR_LOG_LEVEL 模式;none/off→silent,debug 打印收信原始结构保留);.env.example 收敛为密钥+地址类变量,其余旋钮归 compose;compose 撤掉 wxbot 的 config.yml 只读挂载、新增 WXBOT_LOG_LEVEL、WXBOT_URL 保留单横线修复(该文件仍有主人 WIP,未随本提交);文档同步

This commit is contained in:
2026-09-28 07:57:30 +08:00
parent cc66badee8
commit 99293aa39d
12 changed files with 108 additions and 56 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ function timingEqual(a, b) {
function requireService(req, res, next) {
const cfg = engine.getConfig();
const token = (cfg.wxbot && cfg.wxbot.token) || '';
if (!token) return res.status(503).json({ error: '微信接入服务 token 未配置(config wxbot.token / env WXBOT_TOKEN)' });
if (!token) return res.status(503).json({ error: '微信接入服务 token 未配置(env WXBOT_TOKEN)' });
const h = String(req.headers.authorization || '');
if (!h.startsWith('Bearer ') || !timingEqual(h.slice(7).trim(), token)) {
return res.status(401).json({ error: 'invalid service token' });
@@ -69,7 +69,7 @@ function rowFor(req) {
return b;
}
// 面板总览:enabled=false(wxbot.url 未配)时前端整卡隐藏——没配置就当功能不存在;
// 面板总览:enabled=false(WXBOT_URL/WXBOT_TOKEN 未就位)时前端整卡隐藏——没配置就当功能不存在;
// alive/has_qr 与状态自愈全在 wechat.overview()(hook 丢事件也能从实例快照纠回来)。
router.get('/', wrap(async (req, res) => {
res.json(await wechat.overview(String(req.user || '')));