src/env.sh loads .env with set -o allexport; source .env, so every line in it is an unconditional assignment. Adding a variable to .env.example purely as documentation therefore breaks that variable's env-var form as soon as anyone copies the file:
# with BASHUNIT_OUTPUT_FORMAT= present in .env
BASHUNIT_OUTPUT_FORMAT=tap ./bashunit tests/ # silently ignored
CI hits this directly — tests.yml has a Setup Config step that runs cp .env.example .env. This caused 12 red jobs on #862 and was invisible locally, because a developer's existing .env predates any newly added key.
.bashunitrc does not have the problem: bashunit::env::load_config_file applies each key with ${key:-val}, i.e. only when unset.
The bind is that .env.example is currently both the starter config and the reference documentation, and those two roles now conflict. Options:
- Load
.env with the same apply-when-unset semantics as .bashunitrc (changes precedence — needs a decision on whether .env should beat an exported variable).
- Keep
.env.example minimal and move the full variable reference to docs/configuration.md.
- Ship the reference entries commented out.
A stopgap comment was added in #862 warning not to add variables there, but the underlying conflict stands.
src/env.shloads.envwithset -o allexport; source .env, so every line in it is an unconditional assignment. Adding a variable to.env.examplepurely as documentation therefore breaks that variable's env-var form as soon as anyone copies the file:CI hits this directly —
tests.ymlhas aSetup Configstep that runscp .env.example .env. This caused 12 red jobs on #862 and was invisible locally, because a developer's existing.envpredates any newly added key..bashunitrcdoes not have the problem:bashunit::env::load_config_fileapplies each key with${key:-val}, i.e. only when unset.The bind is that
.env.exampleis currently both the starter config and the reference documentation, and those two roles now conflict. Options:.envwith the same apply-when-unset semantics as.bashunitrc(changes precedence — needs a decision on whether.envshould beat an exported variable)..env.exampleminimal and move the full variable reference todocs/configuration.md.A stopgap comment was added in #862 warning not to add variables there, but the underlying conflict stands.