Skip to content

chore: make backend worker API URL configurable via WORKER_API_URL#1409

Merged
brendan-kellam merged 2 commits into
mainfrom
brendan/configurable-worker-api-url
Jul 1, 2026
Merged

chore: make backend worker API URL configurable via WORKER_API_URL#1409
brendan-kellam merged 2 commits into
mainfrom
brendan/configurable-worker-api-url

Conversation

@brendan-kellam

@brendan-kellam brendan-kellam commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The backend worker API was hardcoded to localhost:3060 in both the worker (api.ts) and the web app that calls it (workerApi/actions.ts). This adds a single WORKER_API_URL env var (default http://localhost:3060): the web app dials it, and the worker derives its listen port from it, so the URL and port can't drift.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Changed
    • Made the worker API address configurable through an environment variable, with a sensible default.
    • Updated the backend to determine its listening port from the configured worker API address, with fallback ports for common URL schemes.
    • Switched the web app to use the same configurable worker API address for requests.

The backend worker API host/port was hardcoded to localhost:3060 in both the
worker (api.ts) and the web app that calls it (workerApi/actions.ts). Add a
WORKER_API_URL env var (default http://localhost:3060): the web app dials it,
and the worker derives its listen port from it, so the two can't drift.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

This comment has been minimized.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@brendan-kellam brendan-kellam changed the title feat: make backend worker API URL configurable via WORKER_API_URL chore: make backend worker API URL configurable via WORKER_API_URL Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 05f77107-9abd-4080-a223-e1d0135b8e02

📥 Commits

Reviewing files that changed from the base of the PR and between 3a7bf2d and 8ca2722.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • packages/backend/src/api.ts
  • packages/shared/src/env.server.ts
  • packages/web/src/features/workerApi/actions.ts

Walkthrough

Introduces a WORKER_API_URL environment variable (default http://localhost:3060) in the shared env schema, replacing hardcoded worker API addresses in the backend port derivation and web worker API actions, with a corresponding changelog entry.

Changes

WORKER_API_URL configuration

Layer / File(s) Summary
Env schema for WORKER_API_URL
packages/shared/src/env.server.ts
Adds WORKER_API_URL to the server env schema, validated as a URL string with a default of http://localhost:3060.
Consume WORKER_API_URL in backend and web actions
packages/backend/src/api.ts, packages/web/src/features/workerApi/actions.ts, CHANGELOG.md
Backend derives its listening PORT by parsing env.WORKER_API_URL (falling back to 443/80 by protocol); web actions read env.WORKER_API_URL instead of a hardcoded URL; changelog documents the new configurability.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EnvServer as env.server.ts
  participant BackendApi as api.ts
  participant WebActions as actions.ts
  EnvServer->>EnvServer: define WORKER_API_URL with default http://localhost:3060
  BackendApi->>EnvServer: read env.WORKER_API_URL
  BackendApi->>BackendApi: parse URL, derive PORT (explicit, or 443/80 by protocol)
  WebActions->>EnvServer: read env.WORKER_API_URL
  WebActions->>WebActions: use WORKER_API_URL as fetch base URL
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch brendan/configurable-worker-api-url

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brendan-kellam brendan-kellam merged commit e706330 into main Jul 1, 2026
8 of 9 checks passed
@brendan-kellam brendan-kellam deleted the brendan/configurable-worker-api-url branch July 1, 2026 23:08
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