Skip to content

feat(gateway): point the client at another codev-backend with CODEV_BACKEND_URL - #329

Merged
quickbeard merged 1 commit into
mainfrom
feat/backend-url-override
Aug 26, 2026
Merged

quickbeard merged 1 commit into
mainfrom
feat/backend-url-override

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Adds an env override so a developer can point CoDev Code at a codev-backend running somewhere else — a local one (bun dev in that repo serves http://127.0.0.1:8787), or a staging deploy.

export const BACKEND_URL = process.env.CODEV_BACKEND_URL || `${BASE_URL}/codev-backend`

Why an override rather than editing the URL

Testing a backend change end-to-end previously meant editing the baked BACKEND_URL and remembering to put it back. A 127.0.0.1 that slips into a commit points every user's client at their own machine — a silent, total sign-in outage, and one that would look like a network problem rather than a bad deploy. Unset, this is inert: the baked URL is exactly what ships.

SSO is deliberately not overridable

Only the exchange moves. A locally-run backend still verifies tokens against the real SSO_USERINFO_URL, so the login flow has to mint a genuine token from the real provider — pointing SSO at localhost would just break sign-in.

Where it applies

@codev/gateway is Node-only (TUI, desktop main process, @codev/upload, the CLI); nothing in packages/app or the renderer imports it at runtime, so process.env is always available where this is read. For the desktop app the variable must be exported before launching — the main process reads it, so a renderer reload won't pick it up.

CODEV_BACKEND_URL=http://127.0.0.1:8787 <run the TUI / bun dev the desktop app>

Pairs with the same override in CoDev Hub, so both clients can be aimed at one backend for a single test run.

Notes

  • No DIVERGENCES.md row: packages/codev-gateway/ is a fork-only package, and the file is fork-only. (The one mention of @codev/gateway in that file is a dependency line in packages/tui/package.json, untouched here.)
  • No CHANGELOG.md entry: this is a developer testing knob, not user-facing behaviour.
  • No test: const.ts reads the variable at module load, so pinning it would mean re-importing the module under a mutated env — more machinery than the one-line expression is worth.

bun typecheck clean in packages/codev-gateway.

…ACKEND_URL

Testing a codev-backend change end-to-end meant editing the baked BACKEND_URL
and remembering to put it back — and a localhost URL that slips into a commit
points every user's client at their own machine, which is a silent, total
sign-in outage.

Unset, the baked URL is what ships, so this is inert in every real install.

SSO is deliberately not overridable: a locally-run backend still verifies
tokens against the real provider, so the login flow has to mint a real one.
Only the exchange moves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@quickbeard
quickbeard merged commit b868228 into main Aug 26, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the feat/backend-url-override branch August 26, 2026 06:38
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