Secrets
Secrets are typically used for storing sensitive information such as API keys and auth tokens. For deployed Workers, they are set via the dashboard or Wrangler CLI.
In local development, secrets can be provided to your Worker by using a .dev.vars
file.
If you are using Cloudflare Environments then the relevant .dev.vars
file will be selected.
For example, CLOUDFLARE_ENV=staging vite dev
will load .dev.vars.staging
if it exists and fall back to .dev.vars
.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark