Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(deploy): reuse Worker authentication secret

tianma-ifb92487ce3b7c
diff --git a/docs/agent-deploy-cloudflare.md b/docs/agent-deploy-cloudflare.md
index 3426aebb..9da8980a 100644
--- a/docs/agent-deploy-cloudflare.md
+++ b/docs/agent-deploy-cloudflare.md
@@ -25,6 +25,7 @@ This document defines the standard operating specifications and conventions for
- **R2 Bucket Binding**: Binding name `RESOURCES`, associated with a globally unique R2 Bucket.
- **Admin username**: Configure `EDGE_EVER_AUTH_USERNAME`; it defaults to `admin` and can be replaced with a custom username.
- **Worker Secret**: Add secret `EDGE_EVER_AUTH_PASSWORD` for initial admin password.
+ - Keep this password only as a Worker runtime Secret; do not copy it into Workers Builds variables. The standard deploy entrypoint reuses and verifies the existing Secret.
5. **Configure Workers Builds Commands**
- In the Cloudflare project build settings, set the standard commands:
diff --git a/docs/agent-deploy-cloudflare.zh-CN.md b/docs/agent-deploy-cloudflare.zh-CN.md
index 2567981b..6a214ffc 100644
--- a/docs/agent-deploy-cloudflare.zh-CN.md
+++ b/docs/agent-deploy-cloudflare.zh-CN.md
@@ -25,6 +25,7 @@
- **R2 存储桶绑定**:Binding 名称填 `RESOURCES`,关联全局唯一的 R2 Bucket。
- **管理员用户名**:配置 `EDGE_EVER_AUTH_USERNAME`,默认值为 `admin`;如需自定义,可替换为其他用户名。
- **Worker Secret**:添加密钥 `EDGE_EVER_AUTH_PASSWORD`,值为初始管理员登录密码。
+ - 该密码只配置为 Worker 运行时 Secret,不要复制到 Workers Builds 构建变量;标准部署入口会复用并验证已存在的 Secret。
5. **配置 Workers Builds 命令**
- 在 Cloudflare 项目的构建设置中,填入以下标准命令:
diff --git a/docs/cloudflare-workers-builds.md b/docs/cloudflare-workers-builds.md
index c440d578..6c62c6ea 100644
--- a/docs/cloudflare-workers-builds.md
+++ b/docs/cloudflare-workers-builds.md
@@ -10,6 +10,8 @@ Authorization:
2. If the Agent integration needs a Cloudflare API token, use a User API Token limited to the target account.
3. Configure the deployment API token in Cloudflare under **Worker -> Settings -> Builds -> API token**.
+Configure `EDGE_EVER_AUTH_PASSWORD` under the Worker's **Settings -> Variables and Secrets** as a runtime Secret; do not copy the password into Builds variables. `deploy:cloudflare-builds` reuses that Secret and verifies its presence after deployment.
+
## Updates and troubleshooting
- A push to `main` builds, applies D1 migrations, deploys, and verifies EdgeEver.
diff --git a/docs/cloudflare-workers-builds.zh-CN.md b/docs/cloudflare-workers-builds.zh-CN.md
index 76c39574..20d36859 100644
--- a/docs/cloudflare-workers-builds.zh-CN.md
+++ b/docs/cloudflare-workers-builds.zh-CN.md
@@ -10,6 +10,8 @@
2. 如果 Agent 集成需要 Cloudflare API Token,使用限制到目标账号的 User API Token。
3. 部署 API Token 在 Cloudflare **Worker -> Settings -> Builds -> API token** 中配置。
+`EDGE_EVER_AUTH_PASSWORD` 应配置在 Worker 的 **Settings -> Variables and Secrets** 中,作为运行时 Secret;不要把密码复制到 Builds 的构建变量。`deploy:cloudflare-builds` 会复用该 Secret,并在部署后验证它是否存在。
+
## 更新与排错
- `main` 推送会自动构建、执行 D1 migration、部署并验证。
diff --git a/docs/deploy-cloudflare-button.md b/docs/deploy-cloudflare-button.md
index adb60019..d9e274a7 100644
--- a/docs/deploy-cloudflare-button.md
+++ b/docs/deploy-cloudflare-button.md
@@ -54,6 +54,8 @@ Log into your [Cloudflare Dashboard](https://dash.cloudflare.com/):
> `EDGE_EVER_AUTH_USERNAME` is prefilled with `admin`. Most users can keep this value. Advanced users can replace it with a custom administrator username; the configured username is required at login.
+> `EDGE_EVER_AUTH_PASSWORD` is a Worker runtime Secret, not a Workers Builds variable. The standard deploy command reuses and verifies this Secret; do not duplicate the password in build variables.
+
---
### Step 4: Set Build Commands & Start Build
diff --git a/docs/deploy-cloudflare-button.zh-CN.md b/docs/deploy-cloudflare-button.zh-CN.md
index 3320dbd3..6cc0be1e 100644
--- a/docs/deploy-cloudflare-button.zh-CN.md
+++ b/docs/deploy-cloudflare-button.zh-CN.md
@@ -54,6 +54,8 @@
> `EDGE_EVER_AUTH_USERNAME` 默认预填为 `admin`。普通用户可以直接使用这个值;如果希望使用其他管理员用户名,可在这里修改。请记住部署时填写的用户名,登录时需要同时输入用户名和密码。
+> `EDGE_EVER_AUTH_PASSWORD` 是 Worker 运行时 Secret,不是 Workers Builds 构建变量。标准部署命令会复用并验证这个 Secret;无需、也不应把密码重复填写到构建变量中。
+
---
### 步骤 4:设置构建命令并启动构建
diff --git a/package.json b/package.json
index 66a8f29e..f9fd66a1 100644
--- a/package.json
+++ b/package.json
@@ -82,7 +82,7 @@
"deploy:manual": "export EDGE_EVER_DEPLOYMENT_TRIGGER=manual EDGE_EVER_DEPLOYMENT_METHOD=local_cli && bun run deploy:doctor && bun run build:cloudflare && bun run deploy:ci",
"deploy:ci": "bun run db:migrate:remote && bun run deploy:worker && bun run deploy:verify",
"deploy:worker": "bun scripts/run-wrangler.mjs deploy",
- "deploy:cloudflare-builds": "bun run deploy:ci",
+ "deploy:cloudflare-builds": "EDGE_EVER_USE_EXISTING_AUTH_SECRET=true bun run deploy:ci",
"deploy:verify": "bun scripts/verify-deployment.mjs",
"demo:sync": "bun scripts/sync-demo.mjs",
"deploy:builds:setup": "bun scripts/cloudflare-workers-builds.mjs setup",
diff --git a/tests/deployment-entrypoints.test.ts b/tests/deployment-entrypoints.test.ts
index 896b65db..62025653 100644
--- a/tests/deployment-entrypoints.test.ts
+++ b/tests/deployment-entrypoints.test.ts
@@ -48,7 +48,9 @@ describe("Cloudflare deployment entrypoints", () => {
expect(scripts["deploy:ci"]).toBe(
"bun run db:migrate:remote && bun run deploy:worker && bun run deploy:verify",
);
- expect(scripts["deploy:cloudflare-builds"]).toBe("bun run deploy:ci");
+ expect(scripts["deploy:cloudflare-builds"]).toBe(
+ "EDGE_EVER_USE_EXISTING_AUTH_SECRET=true bun run deploy:ci",
+ );
});
test("online deployment declares the required authentication Secret", () => {
@@ -57,6 +59,11 @@ describe("Cloudflare deployment entrypoints", () => {
const packageJson = JSON.parse(readRepositoryFile("package.json"));
expect(packageJson.cloudflare.bindings.EDGE_EVER_AUTH_PASSWORD.description).toBeTruthy();
+
+ const englishGuide = readRepositoryFile("docs/deploy-cloudflare-button.md");
+ const chineseGuide = readRepositoryFile("docs/deploy-cloudflare-button.zh-CN.md");
+ expect(englishGuide).toContain("Worker runtime Secret, not a Workers Builds variable");
+ expect(chineseGuide).toContain("Worker 运行时 Secret,不是 Workers Builds 构建变量");
});
test("online deployment resolves the D1 id without editing the repository config", () => {