From 9c4333defbdad2e78739f4f1fa31396988639c15 Mon Sep 17 00:00:00 2001 From: uncle6me-web Date: Wed, 24 Jun 2026 12:26:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(cli):=20self-hosted=20=E6=B3=A8=E5=85=A5=20?= =?UTF-8?q?cypher=20KBDB=5FBASE=5FURL=20=E6=8C=87=E5=90=91=E7=94=A8?= =?UTF-8?q?=E6=88=B6=E8=87=AA=E5=B7=B1=E7=9A=84=20kbdb=EF=BC=88issue=20#2?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit injectWranglerConfig 的 self-hosted 分支原本只注 database_id / MULTI_TENANT, 漏了 KBDB_BASE_URL → cypher /kbdb/* 一律指向官方 arcrun-kbdb.uncle6-me, self-hosted 用戶資料默默寫進官方庫(隔離破損)。 比照既有注入模式,用 ctx.workerSubdomain 把 KBDB_BASE_URL 就地改寫成 arcrun-kbdb..workers.dev。init 與 update 共用此注入點,一處修兩條路。 驗證:tsc --noEmit 通過;真實 cypher toml 注入 subdomain=leo21c → KBDB_BASE_URL = "https://arcrun-kbdb.leo21c.workers.dev"。 Co-Authored-By: Claude Opus 4.8 (1M context) --- cli/src/lib/deploy.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cli/src/lib/deploy.ts b/cli/src/lib/deploy.ts index 854bece..4afdd1f 100644 --- a/cli/src/lib/deploy.ts +++ b/cli/src/lib/deploy.ts @@ -397,6 +397,16 @@ function injectWranglerConfig(tomlPath: string, ctx: DeployContext): void { // 只對有 [vars] 的 worker(mcp / cypher-executor)生效;其餘無 [vars] 的不動。 if (ctx.selfHosted) { toml = injectMultiTenant(toml); + + // self-hosted:把 cypher 的 KBDB_BASE_URL 從官方 arcrun-kbdb.uncle6-me 改成用戶自己帳號的 + // arcrun-kbdb..workers.dev(issue #2)。比照 database_id / MULTI_TENANT 注入模式。 + // 漏這一個 → cypher /kbdb/* fallback 到官方 kbdb worker,self-hosted 資料寫進官方庫(隔離破損)。 + if (ctx.workerSubdomain) { + toml = toml.replace( + /(KBDB_BASE_URL\s*=\s*")[^"]*(")/, + `$1https://arcrun-kbdb.${ctx.workerSubdomain}.workers.dev$2`, + ); + } } toml = stripOfficialOnlyBindings(toml);