-
Notifications
You must be signed in to change notification settings - Fork 10k
Document CLOUDFLARE_ENV environment variable for Wrangler #26400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: production
Are you sure you want to change the base?
Document CLOUDFLARE_ENV environment variable for Wrangler #26400
Conversation
- Add CLOUDFLARE_ENV to system environment variables documentation - Update environments documentation to mention CLOUDFLARE_ENV usage - Add changelog entry for the new feature Related to cloudflare/workers-sdk#11228 Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
src/content/changelog/workers/2025-11-09-cloudflare-env-variable.mdx
Outdated
Show resolved
Hide resolved
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
| CLOUDFLARE_ENV=production npm run build & wrangler deploy | ||
| ``` | ||
|
|
||
| When using `@cloudflare/vite-plugin`, the build process generates a "redirected deploy config" that is flattened to only contain the active environment. Wrangler will validate that the environment specified matches the environment used during the build to prevent accidentally deploying a Worker built for one environment to a different environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! Added the link to the generated wrangler configuration documentation.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
Summary
This PR documents the new
CLOUDFLARE_ENVenvironment variable feature for Wrangler, which allows users to select environments without using the--envflag. This feature is being added in workers-sdk PR #11228.Changes made:
CLOUDFLARE_ENVto the system environment variables documentation with usage examples--envflagKey points for reviewers:
&to run commands in parallel (npm run build & wrangler deploy). Please verify this is the intended behavior vs&&for sequential execution, given the context suggests the environment should be set once and used for both operations--envcommand line argument takes precedence over theCLOUDFLARE_ENVenvironment variable (documented consistently across all three locations)@cloudflare/vite-pluginwhere the environment needs to be consistent between build and deployDocumentation checklist
Link to Devin run: https://app.devin.ai/sessions/fc5ba87ae01f4b21ae0916c0e67beddc
Requested by: @petebacondarwin
Related PR: cloudflare/workers-sdk#11228