Skip to content

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

fix: expose one Cloudflare setup token

yoma6c5a4980f745
diff --git a/.env.local.example b/.env.local.example
index 4999ede8..1a0c3207 100644
--- a/.env.local.example
+++ b/.env.local.example
@@ -5,22 +5,11 @@
# Find it with `bunx wrangler whoami`.
CLOUDFLARE_ACCOUNT_ID=
-# Cloudflare API token.
-# Leave empty when authenticated locally with `wrangler login`; set it for CI/CD deployments.
-CLOUDFLARE_API_TOKEN=
-
-# Optional USER API Token for configuring Cloudflare Workers Builds.
-# Do NOT use an Account API Token: the Workers Builds Configuration API accepts
-# user-scoped tokens only. Create it at https://dash.cloudflare.com/profile/api-tokens
-# (My Profile -> API Tokens, not Manage Account -> Account API Tokens):
-# Do not choose a prebuilt template (including Edit Cloudflare Workers). Instead:
-# Create Token -> Create Custom Token -> add Account permissions:
+# User API Token used only by `bun run deploy:builds:setup`.
+# Create a custom token at https://dash.cloudflare.com/profile/api-tokens with:
# - Workers Builds Configuration: Edit
# - Workers Scripts: Read
-# Verify that exact two-permission summary before creating it. Cloudflare shows the
-# value once: save it here privately, never commit, screenshot, or share it.
-# Limit it to the Cloudflare account that hosts this instance and set an expiry.
-# It is used only by `bun run deploy:builds:setup` and is never sent to the Worker.
+# Do not use an Account API Token. Never commit or share this value.
EDGE_EVER_BUILDS_API_TOKEN=
# Worker service name.
diff --git a/docs/cloudflare-workers-builds.md b/docs/cloudflare-workers-builds.md
index 7d20ef13..83148ec6 100644
--- a/docs/cloudflare-workers-builds.md
+++ b/docs/cloudflare-workers-builds.md
@@ -31,7 +31,7 @@ Do not use an Account API Token or a prebuilt template. Limit the token to the r
EDGE_EVER_BUILDS_API_TOKEN=<token>
```
-Never commit or share this token. If `CLOUDFLARE_API_TOKEN` is already a User API Token with the same permissions, the command can reuse it.
+Never commit or share this token.
![Redacted Cloudflare User API Token permissions](assets/cloudflare-workers-builds-user-token.svg)
diff --git a/docs/cloudflare-workers-builds.zh-CN.md b/docs/cloudflare-workers-builds.zh-CN.md
index abc12117..a3644cd9 100644
--- a/docs/cloudflare-workers-builds.zh-CN.md
+++ b/docs/cloudflare-workers-builds.zh-CN.md
@@ -31,7 +31,7 @@ bun run deploy:builds:setup
EDGE_EVER_BUILDS_API_TOKEN=<token>
```
-不要提交或分享该 token。如果现有 `CLOUDFLARE_API_TOKEN` 已是具备相同权限的 User API Token,命令可以直接复用。
+不要提交或分享该 token。
![Cloudflare User API Token 权限(脱敏界面图)](assets/cloudflare-workers-builds-user-token.svg)
diff --git a/package.json b/package.json
index 4fd793d8..c9b8d99d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "edgeever",
- "version": "0.2.3",
+ "version": "0.2.4",
"private": true,
"type": "module",
"workspaces": [
diff --git a/scripts/cloudflare-workers-builds.mjs b/scripts/cloudflare-workers-builds.mjs
index b0156025..149060cf 100644
--- a/scripts/cloudflare-workers-builds.mjs
+++ b/scripts/cloudflare-workers-builds.mjs
@@ -61,6 +61,7 @@ const gitRepository = () => {
return { owner: match[1], repository: match[2] };
};
+// Keep the generic token as a silent fallback for existing installations and CI.
const cfToken = value("EDGE_EVER_BUILDS_API_TOKEN") || value("CLOUDFLARE_API_TOKEN");
const accountId = value("CLOUDFLARE_ACCOUNT_ID");
const workerName = instanceValue("WORKER_NAME");
@@ -233,7 +234,7 @@ const setup = async () => {
if (!workerName) throw new Error("Missing EDGE_EVER_WORKER_NAME.");
if (!cfToken) {
throw new Error(
- "Missing EDGE_EVER_BUILDS_API_TOKEN (or CLOUDFLARE_API_TOKEN). It must be a user-scoped token with Workers Builds Configuration: Edit and Workers Scripts: Read.",
+ "Missing EDGE_EVER_BUILDS_API_TOKEN. It must be a User API Token with Workers Builds Configuration: Edit and Workers Scripts: Read.",
);
}