Skip to content

Commit bc1905d

Browse files
author
Mateus Medeiros
committed
fix serverApiUrl configuration
1 parent 3934c38 commit bc1905d

4 files changed

Lines changed: 10 additions & 20 deletions

File tree

src/host/WriteFluency.AppHost/aspirate-overlays/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ resources:
22
- ../aspirate-output
33
- letsencrypt.yaml
44
- ingress.yaml
5-
- wf-webapp/configmap.yaml
65

76
images:
87
- name: ghcr.io/mateus-mannes/wf-api

src/host/WriteFluency.AppHost/aspirate-overlays/wf-webapp/configmap.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/webapp/src/app/app.config.server.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import { serverRoutes } from './app.routes.server';
55
import { provideApi } from 'src/api/listen-and-write/provide-api';
66
import { environment } from '../enviroments/enviroment';
77

8-
// Server-side API URL - uses environment variables if available (for Kubernetes internal service)
8+
// Server-side API URL - uses Aspire service discovery in Kubernetes
9+
// Aspire sets: services__wf-api__apihttp__0=wf-api:5000
910
// Falls back to build-time environment for local development
10-
const serverApiUrl = process.env['API_URL'] || environment.apiUrl;
11+
const aspireApiUrl = process.env['services__wf-api__apihttp__0'];
12+
const serverApiUrl = aspireApiUrl ? `http://${aspireApiUrl}` : environment.apiUrl;
1113

1214
console.log(`[SSR] Using API URL: ${serverApiUrl}`);
1315

src/webapp/src/server.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ import { environment } from './enviroments/enviroment';
1010

1111
const browserDistFolder = join(import.meta.dirname, '../browser');
1212

13-
// Use environment variables for SSR, fallback to build-time environment
14-
// This allows the container to override API URLs without rebuilding
15-
// In Kubernetes: API_URL=http://wf-api:5000 (internal service)
16-
// In local dev: Uses environment.apiUrl (http://localhost:5000)
17-
const apiUrl = process.env['API_URL'] || environment.apiUrl;
18-
const minioUrl = process.env['MINIO_URL'] || environment.minioUrl;
13+
// Use Aspire service discovery environment variables for SSR
14+
// Aspire sets: services__wf-api__apihttp__0=wf-api:5000
15+
// In Kubernetes: Uses Aspire service discovery
16+
// In local dev: Falls back to environment.apiUrl
17+
const aspireApiUrl = process.env['services__wf-api__apihttp__0'];
18+
const apiUrl = aspireApiUrl ? `http://${aspireApiUrl}` : environment.apiUrl;
1919

2020
console.log(`[Server] Using API URL: ${apiUrl}`);
21-
console.log(`[Server] Using MinIO URL: ${minioUrl}`);
2221

2322
const app = express();
2423
const angularApp = new AngularNodeAppEngine();

0 commit comments

Comments
 (0)