chore: config.js entfernt – Konfiguration zentral über .env.local

- alle Importe und Aufrufe von config.js entfernt
- Webservices nutzen direkt window.location + NEXT_PUBLIC_API_PORT_MODE
- zentrale Konfigurationsstrategie über .env.local abgeschlossen
This commit is contained in:
ISA
2025-05-22 15:02:57 +02:00
parent ef3c511694
commit b48a5b2b58
8 changed files with 44 additions and 70 deletions

View File

@@ -1,2 +1,2 @@
// /config/appVersion
export const APP_VERSION = "1.1.149";
export const APP_VERSION = "1.1.150";

View File

@@ -1,43 +0,0 @@
// Datei: /config/config.js
import { BASE_URL } from "../config/paths";
// Prüfen, ob Mock-Modus aktiv ist
function isMockMode() {
return process.env.NEXT_PUBLIC_USE_MOCK_API === "true";
}
// Definieren der grundlegenden Umgebungseinstellungen und Konfigurationen der Karte
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
let serverURL = "";
if (typeof window !== "undefined") {
serverURL = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80` : `${window.location.origin}`;
}
if (typeof window !== "undefined" && !serverURL && !isMockMode()) {
throw new Error("Die Umgebungsvariable ist nicht gesetzt!");
}
if (typeof window !== "undefined") {
console.log("%c 1- serverURL in config:", "color: #006400;", serverURL);
}
// Initialisieren von Variablen, die später im Browserkontext gesetzt werden
let windowHeight, url_string, url, idMap, idUser;
// URL-Setup - dynamisch abhängig von Mock oder Echtbetrieb
if (typeof window !== "undefined") {
windowHeight = window.innerHeight;
url_string = window.location.href;
url = new URL(url_string);
console.log("%c 2- URL in config:", "color: #006400; font-size: 16px; background-color: #f0f0f0;", url);
idMap = url.searchParams.get("m");
idUser = url.searchParams.get("u");
console.log(`4- Parameter 'idMap' : ${idMap}`);
console.log(`5- Parameter 'idUser': ${idUser}`);
}
// Export der Variablen und URLs
export { serverURL, windowHeight, url_string, url, idMap, idUser, isMockMode };