Cloudflare secrets

anyone know if its possible to have env variables not in wrangler.toml file and use the default cloudflare workers cicd deploy?
4 Replies
peculiarnewbie
yes, you can set them up in the dashboard, then use .dev.vars locally https://developers.cloudflare.com/workers/configuration/secrets/
Cloudflare Docs
Secrets · Cloudflare Workers docs
Store sensitive information, like API keys and auth tokens, in your Worker.
hezz
hezzOP5d ago
Thanks for the suggestion but this doesn't work as expected. If you use the deploy with cloudflare and your variables not in wrangler.toml file they will be all wiped out after manually adding them from your dashboard I copied their deploy step and made my own cicd with github env variables which works now but sucks that it doesn't work like vercel
peculiarnewbie
ah you're using wrangler to deploy. for future reference you can use --env flag for passing your own environment to deploy, or use --keep-vars to prevent them deleting stuff set in the dashboard. https://developers.cloudflare.com/workers/wrangler/commands/#deploy I personally prefer to connect the worker to a github repo and have the vars in dashboard and .dev.vars
hezz
hezzOP4d ago
not using wrangler deploy

Did you find this page helpful?