Guides

Keep .env.example in sync with the code

Compare your root .env.example with the environment variables your code actually reads, add what is proven missing, and never read or expose a secret value.

Updated

SHORT ANSWER

How do I keep .env.example in sync with the variables the code reads?

The environment-example drift shift compares the variable names in a tracked root .env.example with the literal environment reads in your source and configuration. It adds a missing name only when code or docs prove it is required, parks uncertain names, and never records a value.

01

Names only, never values

The comparison uses a name-only projection of the template. Values from .env.example, .env files, process environments, secret stores, and deployment settings are never read, shown, or copied, and the app is never run against real credentials.

02

What changes and what is parked

Each template name and each literal reference ends matched, added, or parked. Optional names, dynamically assembled lookups, and names a deployment system may consume are parked with their evidence; a name is never removed just because a local search found no reference.

03

A second comparison agrees

The receipt records the files, lines, names, and dispositions, never a value. The shift ends when a second name-only comparison agrees with it and the project's existing gate and diff check pass. Application code and deployment settings are never touched.

TRY IT

Start with a bounded prompt

This prompt names the outcome and preserves Nightshift’s review boundary. Paste it into the supported coding host from the project you want to change.

Run the Nightshift environment-example drift shift: compare the root .env.example names with the variables the code reads, and never show a value.
BOUNDARIES

What this workflow does not claim

  • Values are never read or recorded, only names.
  • Names a deployment system may use are parked, never removed.
SOURCES

Evidence and sources

These links support the released behavior, public outcomes, or problem language described on this page.

environment-example-drift contractName-only comparison, dispositions, and secret-handling rules.Open evidence ↗Evidence linesEvidence kinds, owner folders, and what off, report, block, review, and unavailable do.Open evidence ↗
RELATED QUESTIONS

Continue from the question you have

repair documentation driftRead the answer →test developer onboarding docsRead the answer →run a shift in a git worktreeRead the answer →