DEV Community

Discussion on: Environment variables in Node.js. The Right way!

Collapse
 
ovidiu141 profile image
Ovidiu Miu • Edited

Ok, but how to manage the .env files? Where to keep them? How to share them? For example how do I share a .env.development file with another developer since the file is not in the source control?

Collapse
 
numtostr profile image
Vikas Raj

You can include .env.development in the source control. But make sure It doesn't contain any actual keys. Because thats the whole point of secret.

The way I do is I make a .env.sample file with all the env but without any secret or api keys.

Collapse
 
mi1682516 profile image
mi1682516

What do you mean when you say it doesn't contain actual keys? How did the other developer run test like i did on my local when it doesn't contain actual keys?