Give a tool the .env file it insists on, without giving it a secret.
monkeys poo [@profile]
Writes a .env beside .monkeys carrying the same list: every secret's name on
a line of its own, and every public value as it already stands. A name with
nothing after it sets nothing, so the file satisfies whatever wanted one while
the secrets keep arriving through run.
A placeholder would be worse than nothing. The three things that read a .env
treat a bare name and a KEY=x differently, and only the bare name is safe in
all three:
what reads it
DATABASE_URL
DATABASE_URL=x
dotenv, so Vite, SvelteKit, Next
ignored, the environment's value stands
ignored, the environment's value stands
Docker Compose env_file:
taken from the host environment
x goes into the container
set -a; . .env
the environment's value survives
overwritten with x
The bottom two rows are the reason. A placeholder reaches a container or a
shell as a real value, and the failure moves from the start of the program,
where it is obvious, to the first call that uses the key, where it is not.
A profile names which list to write, the way it does everywhere else:
monkeys poo @production
wrote .env for @production: 3 names, 1 value
One file is written, never one per profile. Which profile a program runs under
is run's to decide, and a second place to decide it is a second place to get
it wrong.