This commit is contained in:
Andreas Knuth 2026-02-06 12:11:38 -06:00
parent 36ef7eb4bf
commit 91bcf3c2ed
2 changed files with 30 additions and 7 deletions

View File

@ -1,8 +1,26 @@
// SSR-safe: check if window exists (it doesn't on server-side) // SSR-safe: check if window exists
const hostname = typeof window !== 'undefined' ? window.location.hostname : 'localhost'; // 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 = { export const environment_base = {
// apiBaseUrl: 'http://localhost:3000', // 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', imageBaseUrl: 'https://dev.bizmatch.net',
buildVersion: '<BUILD_VERSION>', buildVersion: '<BUILD_VERSION>',
mailinfoUrl: 'https://dev.bizmatch.net', mailinfoUrl: 'https://dev.bizmatch.net',

View File

@ -1,10 +1,15 @@
import { environment_base } from './environment.base'; import { environment_base } from './environment.base';
export const environment = environment_base; export const environment = { ...environment_base }; // Kopie erstellen
environment.production = true; environment.production = true;
// 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.apiBaseUrl = 'https://api.bizmatch.net';
environment.mailinfoUrl = 'https://www.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_KEY = 'phc_eUIcIq0UPVzEDtZLy78klKhGudyagBz3goDlKx8SQFe';
environment.POSTHOG_HOST = 'https://eu.i.posthog.com'; environment.POSTHOG_HOST = 'https://eu.i.posthog.com';