feat(config): 涉密内容外置到配置目录(档案 140)

把散落在代码里的真实部署值统一收进 config/,代码改为引用配置,
使仓库副本/开源导出不再带出生产域名、IP、内网路径与凭据。

新增 config/:platform.env.example(模板)· load.sh(shell 加载器)·
index.cjs(node 加载器)· README.md(键一览与优先级)。
真实值放 config/platform.env —— 已 .gitignore 排除,不入库、不进导出。

TS 侧新增 src/platform-paths.ts 作部署路径的唯一解析处(零副作用):
platformDir/stateDir/backupDir/artifactDir/installDir/scriptPath。
config.ts 接入这些字段;内置中继种子由生产 URL 改为空(改由
DSHS_OVERLAY_BOOTSTRAP_SEEDS 提供)。修掉 5 处硬编码绝对路径,
src/** 注释中性化 116 行/53 文件。

scripts/** 36 个内部运维脚本:真令牌/PG 口令/隧道目标/主机号/路径
一律改从配置取;web/wake.html 的注册域白名单改为运行时从
location.hostname 推导;test/** 夹具 119 行/13 文件改 RFC 2606/5737
保留值,并把「内置种子必须为空」固化为回归断言。

取证:tsc 0 错;npm test 373/375(唯一失败 lease 属既有);
全仓扫描(大小写不敏感)代码面涉密标识 = 0;已部署 47 并零回归
(/opt/dsh/* 未搬家,/var/lib/dshs/platform 未被误建)。
This commit is contained in:
admin committed 2026-09-19 15:12:19 +08:00
1 parent 9c2e7975ac
commit 452924d89c
100 files changed
+1167 -453

No files matched your search

+6 -5
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# 切换收尾:清理验证残留 + 健康检查(在 47 上跑)
set -uo pipefail
. "$(cd "$(dirname "$0")/.." && pwd)/config/load.sh"
export PGPASSWORD=dshs_cluster_2026
Q() { /usr/bin/psql -h 127.0.0.1 -p 15432 -U dshs -d dshs -tAc "$1"; }
M=http://127.0.0.1:3080
@@ -17,16 +18,16 @@ echo " 剩余用户: $(Q "select string_agg(username||'('||role||')', ', ') fro
echo "=== 2) 停掉验证期间起的实例 ==="
systemctl restart dshs-worker; sleep 4
ssh -n -i /root/.ssh/dshworker_ed25519 -o BatchMode=yes -o StrictHostKeyChecking=accept-new root@106.54.21.172 'systemctl restart dshs-worker' >/dev/null 2>&1
ssh -n -i /root/.ssh/dshworker_ed25519 -o BatchMode=yes -o StrictHostKeyChecking=accept-new root@"$DSH_PEER_PUBLIC_IP" 'systemctl restart dshs-worker' >/dev/null 2>&1
sleep 4
echo " w-47=$(curl -s -m 6 -H 'x-dsh-agent-token: dshs-worker-47-c4b7e19f' http://127.0.0.1:19100/healthz | grep -o '\"instances\":[0-9]*')"
echo " w-106=$(ssh -n -i /root/.ssh/dshworker_ed25519 -o BatchMode=yes -o StrictHostKeyChecking=accept-new root@106.54.21.172 'curl -s -m 6 -H "x-dsh-agent-token: dshs-worker-7f3a91c05e" http://127.0.0.1:19000/healthz | grep -o .instances.:[0-9]*' 2>/dev/null)"
echo " "$DSHS_CLUSTER_HOST_ID"=$(curl -s -m 6 -H "x-dsh-agent-token: $DSHS_CLUSTER_AGENT_TOKEN" http://127.0.0.1:19100/healthz | grep -o '\"instances\":[0-9]*')"
echo " "$DSH_PEER_HOST_ID"=$(ssh -n -i /root/.ssh/dshworker_ed25519 -o BatchMode=yes -o StrictHostKeyChecking=accept-new root@"$DSH_PEER_PUBLIC_IP" "curl -s -m 6 -H 'x-dsh-agent-token: $DSH_PEER_AGENT_TOKEN' http://127.0.0.1:19000/healthz | grep -o .instances.:[0-9]*" 2>/dev/null)"
echo "=== 3) 健康检查 ==="
echo " dshs=$(systemctl is-active dshs) dshs-pg=$(systemctl is-active dshs-pg) dshs-worker=$(systemctl is-active dshs-worker)"
echo " 门户公网: $(curl -s -o /dev/null -w '%{http_code}' -m 12 https://alotbuy.com/login.html)"
echo " 门户公网: $(curl -s -o /dev/null -w '%{http_code}' -m 12 https://$DSHS_BASE_DOMAIN/login.html)"
echo " --- dshs cluster status ---"
cd /opt/dshs && set -a && . /etc/dshs.env && set +a
cd "$DSH_INSTALL_DIR" && set -a && . /etc/dshs.env && set +a
DSHS_DEPLOY_MODE=cluster DSHS_DB_URL="postgres://dshs:[email protected]:15432/dshs" \
node lib/cli.js cluster status 2>&1 | head -9 | sed 's/^/ /'
echo " --- dshs doctor ---"