fix(docker): harden frontend runtime config
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user