Skip to content
Muhammet Şafak
tr
3 min read

When to Move From .env to Centralized Configuration

How far does .env take you, and when do you need a centralized configuration system? Secret management and consistency across environments

TL;DR

A .env file is enough for one application, a few environments and a small team; moving to a central secret manager is a scale decision made on a measured threshold, not a maturity badge. The signals are a growing number of environments, shared secrets, manual rotation and no audit trail. Regardless of the threshold, separate non-sensitive config from secrets from the start, and keep secrets out of the repository.

Handheld reader plugged into a terminal-block enclosure with tags marked CENTRAL CONFIG and obsolete .env

On one team, .env files were passed hand to hand in Slack DMs. Nobody was sure which secret was current; a rotated key was still sitting in its old form on one server.

.env is the right tool for most projects. The problem is continuing to use it once you’ve outgrown it.

How far .env takes you

For a single application, a handful of environments, and a small team, .env is more than enough. It’s simple, everyone knows it, and it needs no extra system. Swapping it out for a secret manager too early adds complexity for a problem you don’t have.

Most projects spend their entire life in this simplicity. Before moving on to the next section, make sure you’ve genuinely crossed that threshold.

Where the cracks start

Concrete signs that .env is no longer enough:

  • The number of environments has grown — dev, staging, multiple production environments, preview environments — and the same secret has to be updated by hand in several places.
  • Multiple applications share the same secrets; there’s no single source of truth.
  • Secret rotation is done manually, and a spot gets missed on a regular basis.
  • “Who changed this key, and when?” is a question with no answer.
  • A secret is floating around in a chat history or on a developer’s disk.

Each of these is small on its own; together, they turn secrets into a source of incidents.

What centralized configuration buys you

A secret manager — Vault, AWS Secrets Manager, Doppler, and the like — buys you a single source of truth, automatic rotation, an audit of who accessed what, and access control.

It has a cost too: one more system to run or depend on, one more tool to learn. That’s why the move is a measured threshold decision, not a fashion.

Separate config from secrets

Independent of that threshold, there’s a distinction you should make from the start: config and secret are not the same thing.

  • Config — non-sensitive settings: feature flags, timeout values, page size. These can comfortably live in the repo, under version control.
  • Secret — values that cause harm when leaked: a database password, an API key, an encryption key. These should never live in the repo.

Mixing the two into a single .env pile turns even an ordinary settings change into touching a secrets file. Manage the non-sensitive from code; keep the sensitive away from code.

The migration threshold

The decision in one sentence: when secret count × environment count × the number of people touching those secrets turns manual .env management into a measurable source of errors, move to a centralized system. Not because you heard about it at a conference; because you’ve had a real incident from a mishandled secret.

Unused, forgotten config keys are a separate signal too — as I noted in signals of an over-complex system, whichever system you move to, clean out dead settings regularly.


Moving from .env to centralized configuration is a scale decision, not a maturity badge. On a small project, a centralized secret manager solves a problem .env doesn’t — that is, nothing.

Choose the tool for the project’s real size — not the size you dream of.

Sources

Related

Comments

Sign in with your GitHub account to join the discussion. Comments are stored in GitHub Discussions.

Search the site

Start typing to search posts, projects and pages.

Esc to close Powered by Pagefind