The portal's apex list was hardcoded to [stage.breakpilot.com, breakpilot.com, localhost]. Deploying it at portal-dev.meghsakha.com (or any other hostname while the canonical domain isn't registered yet) hits the apex fallback for every subdomain because the parser doesn't recognize the suffix.
What
Add a comma-separated PORTAL_APEX_HOSTS env var that prepends extras to the default list. Sorted longest-first so the suffix-strip loop stays correct.
PORTAL_APEX_HOSTS=portal-dev.meghsakha.com
Now acme.portal-dev.meghsakha.com parses to { kind: "tenant", slug: "acme" }.
The defaults (breakpilot.com, stage.breakpilot.com, localhost) still work without setting the env.
Test plan
pnpm test — full suite passes with 100% coverage on src/lib (unchanged from before; the IIFE is exercised by existing parseHost tests)
After merge + image rebuild + redeploy with PORTAL_APEX_HOSTS=portal-dev.meghsakha.com, the portal recognizes <slug>.portal-dev.meghsakha.com subdomains as tenants
## Why
The portal's apex list was hardcoded to `[stage.breakpilot.com, breakpilot.com, localhost]`. Deploying it at `portal-dev.meghsakha.com` (or any other hostname while the canonical domain isn't registered yet) hits the apex fallback for every subdomain because the parser doesn't recognize the suffix.
## What
Add a comma-separated `PORTAL_APEX_HOSTS` env var that prepends extras to the default list. Sorted longest-first so the suffix-strip loop stays correct.
```bash
PORTAL_APEX_HOSTS=portal-dev.meghsakha.com
```
Now `acme.portal-dev.meghsakha.com` parses to `{ kind: "tenant", slug: "acme" }`.
The defaults (breakpilot.com, stage.breakpilot.com, localhost) still work without setting the env.
## Test plan
- [x] `pnpm test` — full suite passes with 100% coverage on src/lib (unchanged from before; the IIFE is exercised by existing parseHost tests)
- [ ] After merge + image rebuild + redeploy with `PORTAL_APEX_HOSTS=portal-dev.meghsakha.com`, the portal recognizes `<slug>.portal-dev.meghsakha.com` subdomains as tenants
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Hardcoded apex list is fine while breakpilot.com is the only target
but blocks deploying the portal under any other hostname. Adds a
comma-separated PORTAL_APEX_HOSTS env that prepends extras to the
default list (longest-first so the suffix-strip loop stays correct).
Needed today to deploy at portal-dev.meghsakha.com without forking
the codebase per environment. The default list still covers dev
(localhost) and prod (breakpilot.com, stage.breakpilot.com).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
sharang
merged commit 5856c1c732 into main2026-06-10 12:05:53 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
The portal's apex list was hardcoded to
[stage.breakpilot.com, breakpilot.com, localhost]. Deploying it atportal-dev.meghsakha.com(or any other hostname while the canonical domain isn't registered yet) hits the apex fallback for every subdomain because the parser doesn't recognize the suffix.What
Add a comma-separated
PORTAL_APEX_HOSTSenv var that prepends extras to the default list. Sorted longest-first so the suffix-strip loop stays correct.Now
acme.portal-dev.meghsakha.comparses to{ kind: "tenant", slug: "acme" }.The defaults (breakpilot.com, stage.breakpilot.com, localhost) still work without setting the env.
Test plan
pnpm test— full suite passes with 100% coverage on src/lib (unchanged from before; the IIFE is exercised by existing parseHost tests)PORTAL_APEX_HOSTS=portal-dev.meghsakha.com, the portal recognizes<slug>.portal-dev.meghsakha.comsubdomains as tenants🤖 Generated with Claude Code