Bugfix: Why does docs URL always show production URL in local develo...
Documentation for Sessions
🐛 Bugfix: Why does docs URL always show production URL in local develo...
Date: 2026-02-09
Time: 22:17:26 UTC
Session: gspace1-101.7
Agent: backend
Confidence: 97%
Status: ✅ Documented
📋 Decision Context
Question:
Why does docs URL always show production URL in local development?
Task: Fix docs URL showing production URL in local development
🎯 Decision Made
Chosen:
Created resolveServiceUrl() utility that prioritizes NODE_ENV over env var, moved to @libs-api/api-viewer
Options Considered:
- Remove DOCS_API_BASE_URL from .env.local
- Invert priority: check NODE_ENV first
- Create reusable resolveServiceUrl utility
💭 Reasoning
The bug: .env.local had DOCS_API_BASE_URL=https://docs-api.gograb.space, and resolveDocsUrl() checked this FIRST before any environment detection. So it always returned the production URL even locally. Fix: created a reusable resolveServiceUrl(configGet, options) utility in @libs-api/api-viewer that checks NODE_ENV first — if not production, uses localhost:PORT; if production, reads from the env var with a hardcoded fallback. This pattern is now reusable by all 4 backends for cross-service URL resolution.
📁 Files Involved
libs/libs-api/api-viewer/src/lib/utils/service-url.tsapis/backend-api/src/app/app.service.ts
🔗 Related
- Decision ID:
dev_1770675446240_rsu9z57 - Session: 101
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation