Cannot use different environment vars in feature branches
How hard can this be?
I just need to have a "staging" environment where different API keys from the prod version are going to be used.
ive gone from using all the QoL things from cloudflare like the dashboard and github integration to now setting secrets with the CLI, disabling the github repo connection altogether and using two workers, one for each environment
i dont meant to compare but this is as easy as adding a new env var in vercel 😦
6 Replies
+1 here.
A while ago, I ended up creating 2 different workers 🤷
api-prod
api-staging
This was before secrets store went public ... 🤔
Wondering if there's an easy way of using that, not sure if you have tried it?Creating a worker per environment is the recommended way if you follow their documentation on environments.
Have you seen this documentation @freddie :
https://developers.cloudflare.com/workers/wrangler/environments/
Cloudflare Docs
Environments
Use environments to create different configurations for the same Worker application.
yes
but this also mean ejecting from their github integration as it doesn’t do that for feature branches
so basically set up your whole cicd yourself if you want one single different secret in your feature branches
where in vercel it’s a dropdown
i’m not saying it should be like vercel, but boy are they winning in DX
You're right regarding feature branches. I decided against it and just went with a more old school dev/staging/prod setup because of the potential mess with vars and bindings
yeah absolute pain
Hey, we're working on fixing this @freddie if you want to chat more. We're designing this right now so Environments work with our Github integration. You can book time on my cal if interested in providing feedback: https://calendar.app.google/Y2ro11X4tooMHUbQ9