No environment variables
Status: verified by test 2 min read -
The rule
The Forge has one rule about the environment: a program reads no environment variable. Not for configuration, not for tests, not once.
Why
An environment variable is a setting that lives nowhere you can look. It is inherited from whatever started the program. It differs between a terminal, a service and a test, and it never appears in the program's own record of its settings. Two runs of the same binary can behave differently and nothing in the program says why.
What replaces it
Settings go in one place instead. Citadel and Ingot read one configuration file, and Anvil keeps its settings in a local database.
How it is enforced
Citadel, Ingot and Barracks each carry a test that parses every Go file in the app and fails the build if it finds a call that reads or changes the process environment, or reaches the home or config folder through it. It checks the app's own files, not the libraries it uses, which read the environment on their own terms. A rule that lives only in a document is a wish. A rule that fails the build is a rule.
What it costs
Starting an app with a different setting means editing a file or a setting, not exporting a variable. We consider that the point.
Sable
