Files
FitOS/web/src/lib/links.ts

24 lines
648 B
TypeScript

declare global {
interface Window {
/** Generowane w kontenerze z config.js.template (envsubst APP_PORT/ADMIN_PORT). */
FITOS_WEB?: { appPort?: number; adminPort?: number };
}
}
/**
* Adresy CTA: ten sam host co strona-wizytówka, porty z config.js
* (dev: app 9001 / admin 9000; staging: 13001 / 13000).
*/
function originFor(port: number) {
const host = window.location.hostname || 'localhost';
return `${window.location.protocol}//${host}:${port}`;
}
export function appUrl() {
return originFor(window.FITOS_WEB?.appPort ?? 9001);
}
export function adminUrl() {
return originFor(window.FITOS_WEB?.adminPort ?? 9000);
}