Issues with runtime variables and secrets

Hello guys I have a cloudflare worker app that's connected to a git repo and auto deploys the new changes whenever I push. But each time it does that I always need to add my database credentials from the dashboard while if I use wrangler I don't have to set it every time it just works am I doing something wrong?
4 Replies
texan
texan•4w ago
Hey @Tee , just tried to reproduce on my end but wasn't able to. This seems to be working as intended. Are you sure you're using secrets and not vars? If you use secrets, those should be available in your next deploy. If you use vars, those would need to be specified in your wrangler.toml, or you can specify keep_vars (https://developers.cloudflare.com/workers/wrangler/configuration/#top-level-only-keys)
Cloudflare Docs
Configuration - Wrangler · Cloudflare Workers docs
Use a configuration file to customize the development and deployment setup for your Worker project and other Developer Platform products.
Tee
TeeOP•4w ago
so I guess im using vars
No description
texan
texan•4w ago
Yup exactly! You can switch to using secrets, or specify the keep_vars like I mentioned above 🙂 Or you can specify the var in your wrangler.toml. That's probably the best route
Tee
TeeOP•4w ago
Thank you so much i specified keep_vars and it works now

Did you find this page helpful?