2026-05-28 16:06:03 -05:00
|
|
|
const GLOBAL_KEY = "__OPENCONCHO_DEFAULT_HONCHO_URL__";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runtime-injected default Honcho base URL for container deployments.
|
|
|
|
|
*
|
2026-06-02 11:53:42 -05:00
|
|
|
* The Docker image writes `/config.js` from `OPENCONCHO_DEFAULT_HONCHO_URL` at
|
|
|
|
|
* container start, so one prebuilt image can target any backend without a rebuild.
|
|
|
|
|
* The web build proxies this URL via the same-origin `/api` reverse proxy (no CORS).
|
2026-05-28 16:06:03 -05:00
|
|
|
*
|
2026-06-02 11:53:42 -05:00
|
|
|
* - an absolute URL → that URL (seeds the first instance)
|
|
|
|
|
* - empty / unset → null (no default; the user configures in Settings)
|
2026-05-28 16:06:03 -05:00
|
|
|
*/
|
|
|
|
|
export function runtimeDefaultBaseUrl(): string | null {
|
|
|
|
|
const raw = (globalThis as Record<string, unknown>)[GLOBAL_KEY];
|
|
|
|
|
if (typeof raw !== "string" || raw.trim() === "") return null;
|
2026-06-02 11:53:42 -05:00
|
|
|
return raw.trim();
|
2026-05-28 16:06:03 -05:00
|
|
|
}
|