Architecture: Should proxy-config.ts use process.env for dynamic port reso...

Documentation for Sessions

🏗️ Architecture: Should proxy-config.ts use process.env for dynamic port reso...

Date: 2026-02-06
Time: 19:32:37 UTC
Session: editor2-97.3
Agent: backend
Confidence: 100%
Status: ✅ Documented


📋 Decision Context

Question:

Should proxy-config.ts use process.env for dynamic port resolution?

Task: Session 97: Fix TS2591 Cannot find name process in Angular build


🎯 Decision Made

Chosen:

NO — proxy-config.ts must use plain compile-time constants only (no process.env, no Node.js APIs)

Options Considered:

  1. Use process.env with typeof guard
  2. Use (globalThis as any).process?.env pattern
  3. Use plain compile-time constants

💭 Reasoning

proxy-config.ts is in @libs-foundational/api-config which is imported by Angular frontend apps (gograb-space, gograb-admin, gograb-dev, etc.). Angular compiles this into browser bundles where process does not exist. Even with typeof process !== 'undefined' guard, the Angular compiler (esbuild) still flags TS2591 errors. The only safe approach is plain numeric constants. Backend code that needs runtime env resolution should use cors.factory.ts directly.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation