Skip to content

chore(deploy): deploy with the narrow wizardsofodd Workers token - #53

Merged
dmealing merged 1 commit into
mainfrom
fm/mo-cf-token-wizardsofodd
Nov 25, 2026
Merged

dmealing merged 1 commit into
mainfrom
fm/mo-cf-token-wizardsofodd

Conversation

@dmealing

Copy link
Copy Markdown
Member

Switches this Worker's Cloudflare commands from wrangler OAuth / account-wide credentials to the site's narrow deploy-only token.

Changes

  • New scripts/cf-deploy.sh <command...>: runs keys-axi run --project deploy --env dev --only CLOUDFLARE_WORKERS_TOKEN_WIZARDSOFODD CLOUDFLARE_ACCOUNT_ID, maps the token to CLOUDFLARE_API_TOKEN, unsets inherited CLOUDFLARE_EMAIL / CLOUDFLARE_API_KEY / CLOUDFLARE_API_TOKEN, and runs the command with the repo's lockfile-pinned wrangler (node_modules/.bin, 4.127.0) first on PATH. Same pattern as the metaobjects.com Pages deploy script.
  • npm run deploy, npm run db:migrate:remote and npm run verify:db:remote go through it. verify:db:remote is in predeploy and calls wrangler d1 execute --remote, so it needs the same credentials.
  • docs/runbook.md gets a deploy-credentials paragraph. The CLAUDE.md deploy line now names the script.

Verification (no token value printed)

  • /accounts/<id>/tokens/verify: success: true, status: active.
  • Dry run with polluted CLOUDFLARE_EMAIL / CLOUDFLARE_API_KEY / CLOUDFLARE_API_TOKEN: only CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN reach the command, the inherited token is replaced, and wrangler resolves to node_modules/.bin/wrangler 4.127.0.
  • wrangler whoami through the script reports API Token auth. wrangler deploy --dry-run through the script exits cleanly.
  • No real deploy or remote migration was run. No key or token was revoked or changed.

Route npm run deploy, db:migrate:remote and verify:db:remote through
scripts/cf-deploy.sh, which pulls CLOUDFLARE_WORKERS_TOKEN_WIZARDSOFODD and
CLOUDFLARE_ACCOUNT_ID from Infisical deploy/dev via keys-axi, maps the token
to CLOUDFLARE_API_TOKEN, drops inherited global-key variables and runs the
repo's lockfile-pinned wrangler. Replaces wrangler OAuth / account-wide
credentials for these commands.
@dmealing
dmealing merged commit cffbf7a into main Nov 25, 2026
2 checks passed
@dmealing
dmealing deleted the fm/mo-cf-token-wizardsofodd branch November 25, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant