If you are working on a sophisticated project, you might have found yourself wanting to configure different Environment Variables depending on the Environment your project is deployed to.
With today's release, we're making it possible to configure different Environment Variables for Production, Preview, and Development – right in the Dashboard.
To configure an Environment Variable for your project, simply navigate to your Project Settings and look for the newly added Environment Variables section:
The new "Environment Variables" field in the Project Settings.
Within this section, you can assign an Environment Variable to the Production, Preview, or Development Environment, depending on where you want it to be available.
The platform provides several Environment Variables that contain values provided by the system, such as the URL of the deployment or the name of the Git branch that the deployment origined from.
In order to make one of them available to your code, choose it from this list and enter its name into the project setting like so:
Configuring a System Environment Variable.
Environment Variables specified for the Development Environment are made available to your team and can be downloaded into a local development setup using a newly added
vercel env pull command, which automatically creates a
$ vercel env pull Vercel CLI 18.0.0 Downloading Development Environment Variables for project my-site ✅ Created .env file [510ms]
Retrieving Development Environment Variables locally
Furthermore, you can use
vercel env add and
vercel env remove to add or remove Environment Variables from your project, directly from the command-line.
The new Environment Variables section in the Project Settings lets you specify different Environment Variables for Production, Preview, and Development, without creating a
vercel.json configuration file.
Additionally, sharing Development Environment Variables with your colleagues is now easier than ever before, since they can be pulled from the project using
vercel env pull.
Let us know what you think about this change. We're excited to help you succeed.