build(intake): give the container an ANTHROPIC_API_KEY (#223)

The drafting worker needs a credential, and a Portainer stack variable alone does not reach the container — stack variables are interpolated into the compose file as ${VAR}, and a service receives exactly what its own environment block lists. That is how UPLOADS_DIR went missing in #118, and both files say so; this adds the line that makes the variable actually arrive.

QA takes it from QA_ANTHROPIC_API_KEY, prefixed like the database and SMTP credentials so production's key cannot be pasted there and silently work. It is also worth a key of its own rather than sharing production's, because this is the only credential in either stack that spends money per call, on a path anybody holding an upload link can trigger.

Absent is a working configuration in both, deliberately, which is why prod's line carries `:-` and neither variable joins the always-required list. A submission still arrives, keeps its photos and waits undrafted. Losing somebody's consignment to an expired key would be far worse than an item arriving without its description written, and the photos may be the only copy of something no longer in the sender's hands. USPS is the existing precedent for a credential whose absence degrades rather than fails.

The comments say plainly that a spend limit belongs on the key in the Anthropic console, since nothing in this repository can enforce one and #227's submission ceiling bounds the volume rather than the bill.

docs/ops/production-stack-cutover.md said the compose file interpolates thirteen names and listed them. It now says fourteen, because that document stakes its usefulness on being checked against the file rather than written from memory — a cutover working from a stale list is how a variable gets left behind, which is the failure the document exists to prevent. Counted from the file: exactly fourteen.

composeEnvironment.test.ts passes, 24 tests. It checks that every deployment sets what the validator requires, so adding a variable ahead of a validator entry cannot break it — the entry itself comes with the worker.

Ref #223
This commit is contained in:
2026-09-01 08:32:40 -05:00
parent 789bb32450
commit 2424305d43
3 changed files with 43 additions and 1 deletions
+19
View File
@@ -40,6 +40,13 @@
# ADMIN_GATE_SECRET — the shared secret Nginx Proxy Manager injects as the
# X-Admin-Gate header on the gated location. Both sides must
# hold the same value or the admin API returns 403. See #63.
# QA_ANTHROPIC_API_KEY — optional. Drafts a listing from a submitted photo
# (#223). QA_ prefixed like the others so production's key
# cannot be pasted here by accident, and worth its own key
# rather than sharing production's: this is the only
# credential here that spends money per call, and it is
# reachable by anyone holding an upload link. Leave it unset
# and submissions still arrive, undrafted.
services:
redefined-designs-qa:
@@ -114,6 +121,18 @@ services:
# enough: stack variables are substituted into this file, not handed to
# the container, so a variable with no line here never reaches the app.
- ADMIN_GATE_SECRET=${ADMIN_GATE_SECRET}
# Drafts a listing from a submitted photo (#223). Named QA_ in the stack
# for the same reason as the database and SMTP credentials: pasting
# production's variables in here must not silently work — and this is the
# one credential in the stack that costs money per call, on a path a
# stranger with a link can trigger.
#
# Absent is a working configuration. A submission still arrives, keeps
# its photos and waits in the queue undrafted, because losing somebody's
# consignment to an expired key would be far worse than an item arriving
# without its description written.
- ANTHROPIC_API_KEY=${QA_ANTHROPIC_API_KEY}
volumes:
# Separate uploads directory. Sharing production's would let a QA run
# write into, and a QA teardown delete, real product images.