build(env): make the backend origin come only from .env - #20
Conversation
The environment files still carried the backend URL as a literal fallback, so the origin lived in two places and a stale literal could quietly win whenever `API_BASE_URL` was unset. `apiBaseUrl` now reads the variable and nothing else. Dropping the fallback would otherwise turn a missing variable into an empty origin — every request resolving against the page URL, failing at runtime with nothing pointing at the cause. So `API_BASE_URL` is now required: the generator exits non-zero with the fix in the message, before anything is built. The Goong keys stay optional; without them only the map features stop working. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe build now requires ChangesAPI Base URL Configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Build
participant GenerateEnv as scripts/generate-env.mjs
participant Config as Environment variables and .env
participant Environment as environment.*.ts
Build->>GenerateEnv: Run pre* environment generation
GenerateEnv->>Config: Resolve API_BASE_URL
alt API_BASE_URL is missing
GenerateEnv-->>Build: Exit with code 1
else API_BASE_URL is present
GenerateEnv-->>Build: Generate env.generated.ts
Build->>Environment: Read env.API_BASE_URL
end
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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. Comment |
The environment files still carried the backend URL as a literal fallback, so the origin lived in two places and a stale literal could quietly win whenever
API_BASE_URLwas unset.apiBaseUrlnow reads the variable and nothing else.Dropping the fallback would otherwise turn a missing variable into an empty origin — every request resolving against the page URL, failing at runtime with nothing pointing at the cause. So
API_BASE_URLis now required: the generator exits non-zero with the fix in the message, before anything is built. The Goong keys stay optional; without them only the map features stop working.Summary by CodeRabbit
Documentation
API_BASE_URLis required for builds and is exposed to the browser.Bug Fixes
API_BASE_URLis missing.