diff --git a/bizmatch/src/environments/environment.base.ts b/bizmatch/src/environments/environment.base.ts index 105a49b..023f4cb 100644 --- a/bizmatch/src/environments/environment.base.ts +++ b/bizmatch/src/environments/environment.base.ts @@ -1,8 +1,26 @@ -// SSR-safe: check if window exists (it doesn't on server-side) -const hostname = typeof window !== 'undefined' ? window.location.hostname : 'localhost'; +// SSR-safe: check if window exists +// Im Browser nehmen wir den aktuellen Host (z.B. localhost). +// Auf dem Server (SSR in Docker) nehmen wir 'bizmatch-app' (der Name des Backend-Containers). +const hostname = typeof window !== 'undefined' ? window.location.hostname : 'bizmatch-app'; +const isBrowser = typeof window !== 'undefined'; +// WICHTIG: Port anpassen! +// Lokal läuft das Backend auf 3001. Im Docker Container auch auf 3001. +// Deine alte Config hatte hier :4200 stehen, das war falsch (das ist das Frontend). +const port = 3001; +const protocol = typeof window !== 'undefined' ? 'http' : 'http'; // Intern im Docker meist http export const environment_base = { // apiBaseUrl: 'http://localhost:3000', - apiBaseUrl: `http://${hostname}:4200`, + // GETTER FUNCTION für die API URL (besser als statischer String für diesen Fall) + get apiBaseUrl() { + if (isBrowser) { + // Browser: Nutze die öffentliche HTTPS API + return 'https://api.bizmatch.net'; + } else { + // SSR (Docker): Nutze die interne HTTP Verbindung direkt zum Backend + // WICHTIG: http (nicht https) und Port 3001 + return 'http://bizmatch-app:3001'; + } + }, imageBaseUrl: 'https://dev.bizmatch.net', buildVersion: '', mailinfoUrl: 'https://dev.bizmatch.net', diff --git a/bizmatch/src/environments/environment.prod.ts b/bizmatch/src/environments/environment.prod.ts index 521ad17..94fe321 100644 --- a/bizmatch/src/environments/environment.prod.ts +++ b/bizmatch/src/environments/environment.prod.ts @@ -1,10 +1,15 @@ import { environment_base } from './environment.base'; -export const environment = environment_base; +export const environment = { ...environment_base }; // Kopie erstellen + environment.production = true; -environment.apiBaseUrl = 'https://api.bizmatch.net'; + +// WICHTIG: Diese Zeile auskommentieren, solange du lokal testest! +// Sonst greift er immer aufs Internet zu, statt auf deinen lokalen Docker-Container. +environment.apiBaseUrl = 'https://api.bizmatch.net'; + environment.mailinfoUrl = 'https://www.bizmatch.net'; -environment.imageBaseUrl = 'https://api.bizmatch.net'; +environment.imageBaseUrl = 'https://api.bizmatch.net'; // Ggf. auch auskommentieren, wenn Bilder lokal liegen environment.POSTHOG_KEY = 'phc_eUIcIq0UPVzEDtZLy78klKhGudyagBz3goDlKx8SQFe'; -environment.POSTHOG_HOST = 'https://eu.i.posthog.com'; +environment.POSTHOG_HOST = 'https://eu.i.posthog.com'; \ No newline at end of file