mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-05 13:29:44 +02:00
* fix(selfhost): derive local port URLs from env * fix(selfhost): derive local script URLs
19 lines
518 B
TypeScript
19 lines
518 B
TypeScript
type RuntimeEnv = Record<string, string | undefined>;
|
|
|
|
export function resolveRemoteApiUrl(env: RuntimeEnv): string {
|
|
const explicitRemote = env.REMOTE_API_URL?.trim();
|
|
if (explicitRemote) return explicitRemote;
|
|
|
|
const publicApi = env.NEXT_PUBLIC_API_URL?.trim();
|
|
if (publicApi) return publicApi;
|
|
|
|
const port =
|
|
env.BACKEND_PORT?.trim() ||
|
|
env.API_PORT?.trim() ||
|
|
env.SERVER_PORT?.trim() ||
|
|
env.PORT?.trim();
|
|
if (port) return `http://localhost:${port}`;
|
|
|
|
return "http://localhost:8080";
|
|
}
|