Comparing Configuration and Secrets Management Tools.env filesAdvantages and Disadvantages Compared to EnvKey

What are .env files?

.env files are a popular language-agnostic solution to configuration and secrets management. At first glance, they are extremely simple, which accounts for much of their allure.

Just make a file named .env (or .staging.env or .production.env or .whatever.env) and fill it up with KEY=VAL environment variable pairs for any configuration your app needs for a particular environment. You (hopefully) put this file in your .gitignore so it doesn't get committed to version control.

When your app starts, it slurps up the file via a 'dotenv' library for whatever language you're using, and then you can access your config as environment variables.

⚖️Quick Compare

SecurityEasy IntegrationBug PreventionProductivityAvoid Lock-InOpen Source
.env files ☠️☠️ Very Poor 💪💪 Very Strong ☠️☠️ Very Poor ☠️☠️ Very Poor 💪💪 Very Strong 💪💪 Very Strong
EnvKey 💪💪 Very Strong 💪 Strong 💪💪 Very Strong 💪💪 Very Strong 💪 Strong 💪 Strong
.env filesEnvKey
Security ☠️☠️ Very Poor 💪💪 Very Strong
Easy Integration 💪💪 Very Strong 💪 Strong
Bug Prevention ☠️☠️ Very Poor 💪💪 Very Strong
Productivity ☠️☠️ Very Poor 💪💪 Very Strong
Avoid Lock-In 💪💪 Very Strong 💪 Strong
Open Source 💪💪 Very Strong 💪 Strong

Advantages

Minimal setup time. As described earlier: just pop some key-value pairs in a file, add a single library to your apps, and boom, you're done.

Popular, widely used, and familiar to most developers. Pretty much everyone has used them at this point and they are supported everywhere. EnvKey also supports them!

No lock-in. It's true to an extent that you can avoid a dependency on a on third party vendor like EnvKey by using .env files, but they actually make your organization far more likely to accidentally spill critically sensitive keys and credentials to third parties (and attackers) via insecure, un-encrypted channels like email and chat.

Disadvantages

They're a security nightmare. While you can avoid getting locked in to any third party service or platform when you use .env files, you end up doing something much worse. Because your engineers aren't provided with a built-in, secure way to share configuration with colleagues and keep it in sync across servers, they spread sensitive credentials across an array of third party services, including email, chat, code-hosting, and various vendor tools.

They cause bugs and outages. If you're following best practices, you're keeping your .env files out of git. But that leads directly to a new problem: you're keeping your .env files out of git. You'll need to figure out a way to keep all your .env files in sync. However you handle this probably won't be perfect, and you'll occasionally have engineers and servers with out-of-sync config. Sometimes it won't cause any problems and will get fixed by the next deploy. Other times, it will bring down production or make an engineer spend all day debugging some cryptic-and-difficult-to-reproduce bug that ended up being nothing more than an .env file or environment variable that got out of sync.

They make a royal mess. As a project grows, you end up with duplication everywhere. .env files full of highly sensitive values get sprayed everywhere. They're on developer laptops. They're on servers. They're in emails. They're in Slack. They occasionally slip through into the git repo and you have to Google for whatever arcane commands will expunge them. They're on that one VM you spun up 16 months ago for a quick test and forgot to ever bring down (or patch).

Conclusion

.env files are a reasonable solution at the earliest stages of a new project when only a single engineer or a very small team are working on it, configuration is minimal, and there are no additional environments beyond development (no CI, staging, or production servers). They are quick to setup and free.

But if your seedling project grows into anything slightly more substantial, .env files quickly become a major security risk and a frequent cause of bugs, outages, and other headaches.

They might still occasionally be useful in development or front-end contexts where no sensitive values are involved. EnvKey, in fact, uses a few of them in its own codebase! Used correctly, they can be helpful in some scenarios.

EnvKey is specifically designed to make the transition from .env files quick and painless, even if you have a lot of them. It's designed around many of the same principles, like language-agnosticism, the 12-factor app methodology, and a just-works developer experience.