The Triumph and Tragedy of .env Files
blog.doppler.com
blog.doppler.com
We embrace a lot of things but we particularly enjoy embracing evolutionary shifts, sea changes and modern workflows.
The call to embrace a new thing often comes from the people who made the thing. Embrace Doppler. It's not a complicated new dependency to think about. It just wants a hug.
Sometimes the request for embracement comes from the community. Embrace Rust. Embrace us. Group hug.
It's difficult to say you don't want to embrace something. It's not like saying you don't want to use it. Not wanting to use it is a dispassionate technical decision. Not wanting to embrace it, though; that's very cold of you. Were you not hugged as a child? Why won't you join the embrace?
These are the embracers. The first movers. The ones talking the thing up. Pushed by clever marketing the are the voices that make us laggards already having heard the terms and 'code words' so many times, that once it targets the general audience we already by virtue of repetition feel it being around long enough to be trusted. We feel it is people like us use things like these and don't 'fesr' the new anymore. So it crosses the chasm.
Sometimes it makes sense, FP versus OOP for example are really core differences in beliefs about what is the "right" way to write software. But then you get the same language and being used for asinine tooling like, which CSS pre-processor is best, or articles like "React Considered Harmful".
What? Just me?
I left the article questioning myself the validity of their previous claims, knowing that all along I was reading a self promotion piece. Left a sour taste in my mouth. A disclaimer at the top would have been the proper thing to do...
[edit]: horrible phone autocorrections
I actually agree that .env files are very bad, if only for the simple reason that it’s always bad to have secret information sitting unencrypted on a disk. But I was expecting a suggestion to fix this, not an ad (with next to no description of what their product does, even)
Otherwise it's a good article.
> Local development environments constantly break when required updates to an .env file aren't proactively communicated, e.g. a new secret required after merging a pull request.
Somewhat solved with a .env.example file and code that has sane defaults, but that doesn't get you secrets so certainly that could be handled better.
> The inconsistent environment variable syntax between languages and platforms can easily cause issues, e.g. Docker and GitHub require values to be unquoted while Python and Node.js dotenv packages work with quoted or unquoted values.
Is that really an issue? It's not like you expect project .envs to be portable.
> As .env files are stored in plain-text (not just environment variables in memory), they are at risk of being read by unauthorized users with no audit trail in terms of access and changes made.
True, but I think complicating the situation further by making a secrets manager a dependency increases your attack surface, not reduces it.
I doubt your other or any other system is going to be immune to operator error. How are env files particularly bad?
> Local development environments constantly break when required updates to an .env file aren't proactively communicated, e.g. a new secret required after merging a pull request.
I like having a config.js file that also does some self validation. Another major win for maintenance is to have two .env files- a user .env and a .env-defaults, which load in that order. Basic config can all go into the .env-defaults and get checked in, then if the developer is doing any customization, they have their own .env to do it in. It's made maintaining .env files not a problem for us.
As for the security & sharing problems, these are real enough.