Skip to content

fix: configurable bind address so Docker port mapping works (loopback by default) - #9

Merged
jpelaez-23blocks merged 1 commit into
mainfrom
fix/docker-bind-address
Oct 28, 2026
Merged

jpelaez-23blocks merged 1 commit into
mainfrom
fix/docker-bind-address

Conversation

@jpelaez-23blocks

Copy link
Copy Markdown
Contributor

Problem

Every gateway bound its Express server to 127.0.0.1. Inside a container that is the container's own loopback, so a published port never connected.

Change

  • Each server binds to BIND_ADDRESS (or HOST; BIND_ADDRESS wins), default 127.0.0.1. Non-container runs are unchanged. The helper is src/bind-address.ts in each package (resolve, loopback check, URL formatting, warning text).
  • Each Dockerfile sets ENV BIND_ADDRESS=0.0.0.0 (container only).
  • docker-compose.yml already published 127.0.0.1:PORT:PORT, so it is unchanged and the host side stays loopback-only. No Dockerfile or compose health check existed, so none needed changing.
  • A non-loopback bind with ADMIN_TOKEN unset logs a loud [SECURITY WARNING] at startup. It does not stop the process.
  • Writes: discord, slack and email config PATCH routes already return 403 without ADMIN_TOKEN. slack POST /api/slack/send did not, so it now returns 403 when the token is unset (behaviour change: set ADMIN_TOKEN to keep using it). google-chat and whatsapp have no write routes.
  • READMEs, .env.example files and CHANGELOG updated. Versions: slack 0.1.3, email 0.1.3, discord 0.1.2, whatsapp 0.1.2, google-chat 0.1.2.

Tested

  • tsc --noEmit in all 5 packages: clean. Root npm run lint: 0 errors (63 existing warnings).
  • npm test: discord 42, slack 37, email 17, google-chat 27, all passing (new bind-address.test.ts in each). whatsapp has no test setup.
  • Docker (local): built the slack and whatsapp images. Ran the whatsapp image with -p 127.0.0.1:3021:3021 and a dummy AMP key: /health returned 200 from the host, /api/activity returned 401 without a token and 200 with it, the host's LAN IP on that port did not connect, the no-token run printed the warning, and BIND_ADDRESS=127.0.0.1 in the container reproduced the old failure (empty reply).

Not tested

  • Running the slack, discord, email and google-chat containers (they need real credentials). Their server code change is the same pattern, and only the slack image build was checked.
  • docker compose up as a whole.

🤖 Generated with Claude Code

… by default

Servers read BIND_ADDRESS (or HOST), default 127.0.0.1. Dockerfiles set
BIND_ADDRESS=0.0.0.0; compose keeps publishing on 127.0.0.1 only. Startup warns
loudly on a non-loopback bind without ADMIN_TOKEN. slack POST /api/slack/send
requires ADMIN_TOKEN. Versions: slack 0.1.3, email 0.1.3, discord 0.1.2,
whatsapp 0.1.2, google-chat 0.1.2.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jpelaez-23blocks
jpelaez-23blocks merged commit 8e7f411 into main Oct 28, 2026
6 checks passed
@jpelaez-23blocks
jpelaez-23blocks deleted the fix/docker-bind-address branch October 28, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant