@bensandee/tooling 0.64.1 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -508,6 +508,28 @@ A smoketest is a command that runs against the live Docker stack after all conta
508
508
 
509
509
  If the smoketest command exits non-zero, `docker:check` dumps container logs and fails with reason `"smoketest-failed"`.
510
510
 
511
+ ### Environment variables and compose interpolation
512
+
513
+ A base compose file usually interpolates values it refuses to give a fallback for:
514
+
515
+ ```yaml
516
+ services:
517
+ app:
518
+ environment:
519
+ - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
520
+ ```
521
+
522
+ **Unset variables are filled with an empty string, automatically.** Compose interpolates each file _before_ merging them, so on a host where `ANTHROPIC_API_KEY` is unset it prints `The "ANTHROPIC_API_KEY" variable is not set. Defaulting to a blank string.` on every invocation — including teardown, after the check has already passed. Before each stack comes up, `docker:check` asks compose which variables are still unset and sets each to the empty string compose was substituting anyway: the warnings go away and the value every container sees is unchanged. One line names what was filled.
523
+
524
+ Two things follow from this that are worth knowing:
525
+
526
+ - **Setting the value in the check overlay does not silence the warning.** The overlay overrides the _merged_ value, but the warning comes from interpolating the base file, which happens per-file beforehand. Nothing you can write in the overlay reaches it.
527
+ - **`docker-compose.check.env` is the file that does feed interpolation.** Drop it beside the base compose file and `docker:check` auto-detects it and passes it to compose as `--env-file`. Use it when the check needs _real_ values rather than blanks. Override the location with `dockerCheck.envFile` in `.tooling.json`.
528
+
529
+ **The `PORT` trap:** when a service publishes a `${PORT}`-parameterized port, `docker:check` allocates a free host port and injects it, so a check run never collides with something already bound on the host. Assigning `PORT` in `docker-compose.check.env` (or in the ambient environment) opts out of that — your value is used verbatim, collisions included.
530
+
531
+ `docker-compose.check.env` is exempt from the bst-hook's env-file deny rules, so an agent working in the repo can create and read it. It is a committed, placeholder-holding file for a throwaway stack — do not put real secrets in it.
532
+
511
533
  ### Library API
512
534
 
513
535
  The `@bensandee/tooling/docker-check` export provides utilities for checking Docker Compose stacks programmatically.