Simplifying Environment Variable Management With Vercel
When we’re handling sensitive information and some information we would want to be configured for each environment we usually have these set up as Environment variables. The cool thing with Vercel is that it has a feature that involves managing these environment variables.
Shared Environment Variables
In the past, how you usually manage your environment variables would be simply to copy over the set from one project to another. The cool thing with Vercel is that you can easily manage environment variables as complex as selecting only a number of projects it’s going to appear on.
On the team level, navigate to the Settings tab and then click on Environment Variables. Make sure you’re on the team level because each project will also have it’s own environment variable settings.
When you create your environment variables, be sure to link it to the projects that will be using them. They will only be active once you link them to at least one project. If you forgot to link the project, you can edit the environment variable and you’ll be able to link that way.
When you navigate to the project’s settings and check out the list of environment variables there, you will see two different sections. The first list you’ll see if you start from the top of the page will be the environment variables set on the project itself and just below that will be the ones you’ve linked.
Project Environment Variables
How you utilize environment variables and differentiate information across environments will largely depend on your team's creativity and approach. If the site you are building have created different projects for each environment, this can be as simple as QA, Pre-production and Production environments. It may be literally different projects or different sub sites as well. You will have to still utilize managing some of the environment variables in each of Vercel’s projects.
The view will look very similar to the Team’s environment variable page but you will see that if you add the same variables here it will override what you’ve set up in the team level.
If you needed more information and other criteria to satisfy categorizing environment variables, Vercel has a lot more to offer. Vercel’s documentation on environment variables has some information on also managing System, Framework, Reserved and Sensitive Environment Variables.
For example, Sensitive Environment Variable are non-readable environment variables, as soon as you create them you won’t be able to check their values. You’ll see a toggle when you create the variable which should turn the new variables to sensitive. These cannot be edited as well, only the environment they will be active on can be edit but the key-value pair is not. It’s a pretty powerful feature depending on what or how you’re going to use it.
Start Organizing Soon
If this has caught your attention I would suggest doing it now or soon. If you would suspect your project to soon be growing it’ll only be adding more environment variables and the more environment variables there are it will take more time to restructure it correctly, trust me I’ve experienced it and I wished I knew this sooner. Vercel has a lot of features to offer, take some time to explore and discover these that might improve how you manage your project.