Parse port from CLAW_WORKER_BIND_ADDR
Build TS Worker / build (push) Successful in 1m9s
CI / Typecheck & Lint (push) Failing after 1m44s

The gateway passes CLAW_WORKER_BIND_ADDR as "host:port" (e.g.
"0.0.0.0:8080"). Parse both from it instead of using a separate
CLAW_WORKER_PORT env var. Default to port 8080 to match the
gateway's DEFAULT_GATEWAY_WORKER_BIND_PORT.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wylabb
2026-04-07 23:25:40 +02:00
parent a2d8e804db
commit c183c68f12
2 changed files with 12 additions and 6 deletions
+3 -4
View File
@@ -34,17 +34,16 @@ COPY src/worker/ src/worker/
RUN mkdir -p /state/claude-home /state/claw /workspace
# Default env
ENV CLAW_WORKER_BIND_ADDR=0.0.0.0
ENV CLAW_WORKER_PORT=8780
ENV CLAW_WORKER_BIND_ADDR=0.0.0.0:8080
ENV CLAW_WORKER_STATE_ROOT=/state
ENV CLAW_WORKER_DEFAULT_CWD=/workspace
ENV CLAW_WORKER_MODEL=claude-sonnet-4-6
ENV CLAW_WORKER_PERMISSION_MODE=default
ENV CLAUDE_CONFIG_DIR=/state/claude-home
EXPOSE 8780
EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s \
CMD curl -f http://localhost:8780/healthz || exit 1
CMD curl -f http://localhost:8080/healthz || exit 1
CMD ["bun", "run", "src/worker/main.ts"]
+9 -2
View File
@@ -18,8 +18,15 @@
import { startWorkerServer } from './server.js'
const bindAddr = process.env.CLAW_WORKER_BIND_ADDR ?? '127.0.0.1'
const port = parseInt(process.env.CLAW_WORKER_PORT ?? '8780', 10)
// The gateway passes CLAW_WORKER_BIND_ADDR as "host:port" (e.g. "0.0.0.0:8080").
// Parse both address and port from it, with CLAW_WORKER_PORT as override.
const rawBindAddr = process.env.CLAW_WORKER_BIND_ADDR ?? '0.0.0.0:8080'
const colonIdx = rawBindAddr.lastIndexOf(':')
const bindAddr = colonIdx > 0 ? rawBindAddr.slice(0, colonIdx) : rawBindAddr
const port = parseInt(
process.env.CLAW_WORKER_PORT ?? (colonIdx > 0 ? rawBindAddr.slice(colonIdx + 1) : '8080'),
10,
)
const authToken = process.env.CLAW_WORKER_AUTH_TOKEN
const profileId = process.env.CLAW_WORKER_PROFILE_ID ?? 'default'
const stateRoot = process.env.CLAW_WORKER_STATE_ROOT ?? '/tmp/claw-worker-state'