diff --git a/Dockerfile b/Dockerfile index 4e4365e..da1d71c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,8 @@ ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 ENV CYPRESS_INSTALL_BINARY=0 ENV NODE_ENV=production -# Set API URL for build (create .env file) -RUN echo "GATEWAY_URL=http://localhost:9100" > .env +# GATEWAY_URL is resolved at runtime from the process environment (see +# src/lib/server/gateway.ts), not baked in at build time. # Install build dependencies RUN apt-get update && apt-get install -y python3 make g++ git && rm -rf /var/lib/apt/lists/* diff --git a/src/lib/server/gateway.ts b/src/lib/server/gateway.ts index c3c1d84..f192d82 100644 --- a/src/lib/server/gateway.ts +++ b/src/lib/server/gateway.ts @@ -1,5 +1,8 @@ -// Server-side helper: all backend calls go through the Rust gateway -const GATEWAY_URL = (import.meta.env.VITE_GATEWAY_URL || 'http://localhost:9100').replace(/\/+$/, ''); +// Server-side helper: all backend calls go through the Rust gateway. +// Read from process.env (not import.meta.env) since this is server-only code and the +// gateway URL differs per environment (k8s service DNS) — it must be resolved at +// runtime, not baked in at build time. +const GATEWAY_URL = (process.env.GATEWAY_URL || 'http://localhost:9100').replace(/\/+$/, ''); export function gatewayUrl(path: string): string { const normalized = path.startsWith('/') ? path : `/${path}`;