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:
1 parent
9c2e7975ac
commit
452924d89c
100 files changed
+1167
-453
No files matched your search
@@ -37,9 +37,9 @@ function fakeFetch(payload) {
|
||||
|
||||
/** `via='relay'` 的一台 worker:agent 口号 19000,relay 已把它映射到本机 38253。 */
|
||||
const W106 = {
|
||||
hostId: 'w-106',
|
||||
hostId: 'w-2',
|
||||
agentUrl: 'http://127.0.0.1:19000',
|
||||
reachability: { hostId: 'w-106', via: 'relay', address: '127.0.0.1:38253', scheme: 'http' },
|
||||
reachability: { hostId: 'w-2', via: 'relay', address: '127.0.0.1:38253', scheme: 'http' },
|
||||
token: 'tok-106',
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ function make(opts = {}) {
|
||||
return new RemoteSpawner({
|
||||
agentUrl: 'http://127.0.0.1:19100',
|
||||
token: 'tok-local',
|
||||
defaultHostId: 'w-47',
|
||||
hostIdFor: async () => 'w-106',
|
||||
defaultHostId: 'w-1',
|
||||
hostIdFor: async () => 'w-2',
|
||||
hostsProvider: async () => [W106],
|
||||
fetchImpl: fakeFetch({ running: true, host: '127.0.0.1', port: 21000 }),
|
||||
...opts,
|
||||
@@ -67,7 +67,7 @@ test('T1 翻译器被真的接上:传入的 hostId/endpoint 与返回值都要
|
||||
})
|
||||
assert.deepEqual(await s.endpointFor('u1'), { host: '127.0.0.1', port: 34241 })
|
||||
// ★ 这一条就是首版漏赋值时唯一会红的断言:漏了 ⇒ seen 为空、返回 {21000}
|
||||
assert.deepEqual(seen, [['w-106', { host: '127.0.0.1', port: 21000 }]])
|
||||
assert.deepEqual(seen, [['w-2', { host: '127.0.0.1', port: 21000 }]])
|
||||
})
|
||||
|
||||
test('T2 未给翻译器 ⇒ 原样透传(local / manager-ssh 的同号语义,行为零变化)', async () => {
|
||||
|
||||
Reference in new issue
Block a user