cloudflare · Cloudflare Workers Docs
Workers Environment variables and secrets
Configuring and managing environment variables and secrets for local Cloudflare Workers development using .dev.vars and .env files.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Workers Environment variables and secrets
Configuring and managing environment variables and secrets for local Cloudflare Workers development using .dev.vars and .env files.
When To Use
Use when you need to configure local environment variables, manage sensitive secrets without committing them to git, or set up environment-specific configurations for local Workers development.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-development-testing-environment-variables-and-secrets-workflow-guide.md | Documentation explaining how to configure environment variables and manage sensitive secrets for Cloudflare Workers using Wrangler and local files. | Questions about documentation explaining how to configure environment variables and manage sensitive secrets for Cloudflare Workers u... |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare.text | A text file demonstrating the syntax for defining environment variables and secrets such as SECRET_KEY and APITOKEN for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text file demonstrating the syntax for defining environment variables and secrets such as SECRETKEY and APITOKEN fo... |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-2.text | A text file demonstrating the syntax for defining environment variables and secrets such as API_HOST and SECRETTOKEN for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text file demonstrating the syntax for defining environment variables and secrets such as APIHOST and SECRETTOKEN f... |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-3.text | A text snippet demonstrating the use of the npx wrangler dev command for developing Cloudflare Workers with environment variables. | Exact payloads, commands, or snippets shown in A text snippet demonstrating the use of the npx wrangler dev command for developing Cloudflare Workers with environme... |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-4.text | A text snippet demonstrating the wrangler dev command used to run Cloudflare Workers with environment variables during local development. | Exact payloads, commands, or snippets shown in A text snippet demonstrating the wrangler dev command used to run Cloudflare Workers with environment variables durin... |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-5.text | A text snippet demonstrating the use of the pnpm wrangler dev command for local development with environment variables. | Exact payloads, commands, or snippets shown in A text snippet demonstrating the use of the pnpm wrangler dev command for local development with environment variables. |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-6.text | A text snippet demonstrating the npx vite dev command used for local development of Cloudflare Workers with environment variables. | Exact payloads, commands, or snippets shown in A text snippet demonstrating the npx vite dev command used for local development of Cloudflare Workers with environme... |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-7.text | The terminal command used to run the local development server for Cloudflare Workers with environment variables. | Exact payloads, commands, or snippets shown in The terminal command used to run the local development server for Cloudflare Workers with environment variables. |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-8.text | The command used to run a local development server for Cloudflare Workers using pnpm vite dev. | Exact payloads, commands, or snippets shown in The command used to run a local development server for Cloudflare Workers using pnpm vite dev. |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-9.text | A text file demonstrating the syntax for defining environment variables and secrets in a Cloudflare Workers configuration. | Exact payloads, commands, or snippets shown in A text file demonstrating the syntax for defining environment variables and secrets in a Cloudflare Workers configura... |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-10.text | A command line instruction demonstrating how to use the wrangler dev command with a specific staging environment flag. | Exact payloads, commands, or snippets shown in A command line instruction demonstrating how to use the wrangler dev command with a specific staging environment flag. |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-11.text | A command line instruction demonstrating how to use the wrangler dev command with the staging environment flag. | Exact payloads, commands, or snippets shown in A command line instruction demonstrating how to use the wrangler dev command with the staging environment flag. |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-12.text | A command line instruction demonstrating how to use the wrangler dev command with a specific environment flag. | Exact payloads, commands, or snippets shown in A command line instruction demonstrating how to use the wrangler dev command with a specific environment flag. |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-13.text | A command line example demonstrating how to set the CLOUDFLARE_ENV variable when running the vite development server for Workers. | Exact payloads, commands, or snippets shown in A command line example demonstrating how to set the CLOUDFLAREENV variable when running the vite development server f... |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-14.text | A command line example demonstrating how to set the CLOUDFLARE_ENV variable when running the vite development server. | Exact payloads, commands, or snippets shown in A command line example demonstrating how to set the CLOUDFLAREENV variable when running the vite development server. |
examples/workers-development-testing-environment-variables-and-secrets-cloudflare-15.text | A command line example demonstrating how to set the CLOUDFLARE_ENV variable to staging when running the vite development server. | Exact payloads, commands, or snippets shown in A command line example demonstrating how to set the CLOUDFLAREENV variable to staging when running the vite developme... |
What This Skill Covers
- Do not use vars to store sensitive information in your Worker's Wrangler configuration file. Use secrets instead.
- Main sections:
Basic setup,Multiple local environments,Learn more.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/development-testing/environment-variables
