Skip to content

feat(worker-turbo): deployTokenEnv gives one component its own Cloudflare token (0.24.0) - #27

Merged
vijayakrishnans merged 1 commit into
mainfrom
feat/deploy-token-env
Nov 30, 2026
Merged

vijayakrishnans merged 1 commit into
mainfrom
feat/deploy-token-env

Conversation

@vijayakrishnans

Copy link
Copy Markdown
Contributor

Why. The cloudflare-worker-turbo deploy profile binds one CLOUDFLARE_API_TOKEN per lane, and a component's secretEnv can't rebind it (the planner rejects two references for one key). So when one component needs a wider token, every component in the project ends up holding it. The case here: a Worker with a Cloudflare Container needs Containers Edit (template workers-containers-deploy).

What. A new optional parameter, deployTokenEnv (default empty, pattern ^([A-Z_][A-Z0-9_]*)?$), naming an env var from the component's own secretEnv.

  • When set, the pre-deploy, migrate, deploy and secrets-live steps export CLOUDFLARE_API_TOKEN from that variable, and fail with a clear message when it's empty.
  • When empty, every step keeps the profile's token, so no consumer changes until it opts in.

Checked: scripts/verify.sh passes. Its new stage renders the two fixture workers: the opted-in one switches tokens in all four steps, and the default one mentions no switch in any of them. The rendered bash was also exercised: it fails loudly when the variable is unset and exports it when set.

Includes the README parameter note, docs/verification.md §8 (the later sections renumbered), and stack.yaml bumped to 0.24.0.

🤖 Generated with Claude Code

…lare token (0.24.0)

The deploy profile binds one CLOUDFLARE_API_TOKEN per lane, so a component
that needs a wider token (a Worker with a Container needs Containers Edit)
forced every component in the project onto it. deployTokenEnv names an env
var from the component's own secretEnv; its pre-deploy, migrate, deploy and
secrets-live steps then export CLOUDFLARE_API_TOKEN from it, failing loudly
when it is empty. Left empty, every step keeps the profile's token, so no
consumer changes behaviour until it opts in. verify.sh renders both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T17:51:35.568381Z 140597d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 140597db8e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

`us-east-1`), `orgName`, `owner`, `repo`
- **Optional deploy parameter:** `deployTokenEnv` (default empty). The name
of an env var from the component's own `secretEnv` (for example
`CLOUDFLARE_DEPLOY_TOKEN: "secret://<ws>/<project>/CLOUDFLARE_CONTAINERS_TOKEN"`).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the environment in the token secret URI

When a consumer copies this secretEnv example, the URI omits the environment segment used by the deploy profile and existing component references (secret://<workspace>/<project>/<env>/...). The token lookup will therefore point to the wrong secret path, so the opted-in steps may fail to resolve CLOUDFLARE_DEPLOY_TOKEN; include the environment in the example URI.

Useful? React with 👍 / 👎.

@vijayakrishnans
vijayakrishnans merged commit fcf7b88 into main Nov 30, 2026
3 checks passed
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