fix(docker): harden frontend runtime config

This commit is contained in:
2026-07-11 22:03:24 +02:00
parent 3d939426b1
commit 715de6649b
9 changed files with 75 additions and 11 deletions
+6
View File
@@ -12,6 +12,12 @@ export function resolveBackendUrl(config: RuntimeConfig | undefined): string {
return config?.backendBaseUrl ?? import.meta.env.VITE_BACKEND_URL ?? "";
}
export function joinBackendPath(base: string, path: string): string {
const normalizedBase = base === "/" ? "" : base.replace(/\/+$/, "");
const normalizedPath = path.replace(/^\/+/, "");
return `${normalizedBase}/${normalizedPath}`;
}
export const backendBaseUrl =
resolveBackendUrl(typeof window === "undefined" ? undefined : window.__THOTHII_CONFIG__) ||
"http://localhost:8787";