feat: basePath-Konfiguration von .env in config.json verschoben

basePath wird jetzt in config.json gepflegt statt als NEXT_PUBLIC_BASE_PATH in .env.*
Alle relevanten Code-Stellen lesen basePath dynamisch aus config.json
Dokumentation und Beispiele in Markdown-Dateien entsprechend angepasst
Erhöhte Flexibilität für Deployments ohne Rebuild
This commit is contained in:
ISA
2025-08-20 08:42:24 +02:00
parent bf4fc95b8e
commit 9a2b438eaf
19 changed files with 135 additions and 47 deletions

View File

@@ -5,9 +5,19 @@
* @returns {Promise<Array>} Liste mit Points[]
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
*/
let __configCache;
async function getConfig() {
if (__configCache) return __configCache;
const res = await fetch("/config.json");
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
__configCache = await res.json();
return __configCache;
}
export const fetchGisStationsStaticDistrictService = async () => {
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
const config = await getConfig();
const basePath = config.basePath || "";
if (useMocks) {
const mockBasePath = "/api/mocks/webservice/gisStationsStaticDistrict";