25 lines
1.3 KiB
JavaScript
25 lines
1.3 KiB
JavaScript
// /config/urls.js
|
|
|
|
// Dynamische Bestimmung der URLs basierend auf window.location.origin ohne Port
|
|
let BASE_URL, SERVER_URL, PROXY_TARGET, ONLINE_TILE_LAYER, OFFLINE_TILE_LAYER, MAP_TILES_LAYER;
|
|
|
|
if (typeof window !== "undefined") {
|
|
// Client-seitige Logik
|
|
const url = new URL(window.location.origin);
|
|
const originWithoutPort = `${url.protocol}//${url.hostname}`; // Protokoll und Hostname, ohne Port
|
|
|
|
BASE_URL = `${originWithoutPort}/api`; // Dynamische Basis-URL
|
|
SERVER_URL = originWithoutPort; // Dynamisch ermittelt, ohne Port
|
|
PROXY_TARGET = `${originWithoutPort}:3000`; // Dynamisch für einen Proxy
|
|
//ONLINE_TILE_LAYER = `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`;
|
|
//OFFLINE_TILE_LAYER = `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`;
|
|
ONLINE_TILE_LAYER = "http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Map von Talas_v5 Server
|
|
OFFLINE_TILE_LAYER = "http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Map von Talas_v5 Server
|
|
//ONLINE_TILE_LAYER = `${originWithoutPort}:3000/mapTiles/{z}/{x}/{y}.png`;
|
|
//OFFLINE_TILE_LAYER = `${originWithoutPort}:3000/mapTiles/{z}/{x}/{y}.png`;
|
|
MAP_TILES_LAYER = ONLINE_TILE_LAYER; // Standardwert
|
|
}
|
|
|
|
// Export der dynamischen Werte
|
|
export { BASE_URL, SERVER_URL, PROXY_TARGET, ONLINE_TILE_LAYER, OFFLINE_TILE_LAYER, MAP_TILES_LAYER };
|