How can I use the Production env for branch from dev?
Unanswered
Orange-tailed bumble bee posted this in #help-forum
Orange-tailed bumble beeOP
How can I use the Production env var for a specific branch in Vercel when the branch from dev?
14 Replies
@Melissa Its in settings in vercel
from your selected project click Settings>Environment Variables
Then find the var, click the 3 dots on the right
you can have 1 var for all 3 or you can have 1 for each dealers choice
or if you mean locally just make a file in the root called .env.local and use the prod value there
Vercel will also give your trouble if say you have a var 1 for prod and one for preview and you try to set the prod one for both with out deleting the preview one
Orange-tailed bumble beeOP
Seems simple but im confused here
the branch in the preview, how to make this specific branch get the env of the production?
the branch in the preview, how to make this specific branch get the env of the production?
ok are we talking about hosted on vercel or locally
if hosted on vercel branches other then main are preview deployments
You go to your settings, you go to environment variables in vercel and you set the environment to production and preview
Then when you deploy on a branch that isn't the main or Master branch, a preview deployment will be created using the environment variables you assigned
For the new environment variables to take effect you will have to redeploy the branch
Orange-tailed bumble beeOP
then the previews will be using production-api always unless i assign it back ! got it