DEV Community

Discussion on: Stop Using .env Files Now!

Collapse
 
dishantpandya profile image
Dishant Pandya

True, and he also forgot to mention the dependency of SDK, .env isn't bad, if steps are taken to secure it, and infact there's no way people are going to directly update the code or version the .env, they are going use it for local development, and rather build validation in code to check for environment variables and add up new vars progressively, Secret Managers are special purpose services, they add up complexity for small systems, but solve the problem of scattered and untracked env for large systems, obviously with overhead of using client sdks. Still if you still wish use some secret store for even local dev, use Doppler.

Collapse
 
gregorygaines profile image
Gregory Gaines

Depending on which service you use, you could slide by without an SDK.

I've never heard of a .env used for build validation, can you give an example.

Collapse
 
brense profile image
Rense Bakker

Then why do the people who made dotenv explicitly tell you to NOT commit .env to version control? github.com/motdotla/dotenv#should-...

Thread Thread
 
stojakovic99 profile image
Nikola Stojaković

People never stop to disappoint me with their clinging to bad practices.

Thread Thread
 
dishantpandya profile image
Dishant Pandya

not commiting it to version control is the right thing to do, but using it as source of truth for your variables is simplest thing to do, if one needs unified way of injecting secrets, from various sources there are tool out there like tlr.dev/ which can source secrets from AWS, Vault, etc. all in one place without even using any SDK. That totally depends on choice of the devs.