2 min read
Customize Environment Variables for projects in your Dashboard
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.
New project setting
To configure an Environment Variable for your project, simply navigate to your Project Settings and look for the newly added Environment Variables section:
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.
System environment variables
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:
New command for Vercel CLI
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 .env
file:
$ vercel env pullVercel CLI 18.0.0Downloading Development Environment Variables for project my-site✅ Created .env file [510ms]
Retrieving Development Environment Variables locally
At least version 18.0.0 of Vercel CLI is required to be able to run this command.
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.
Conclusion
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.