fix and update

This commit is contained in:
lendry
2026-06-29 15:08:26 +03:00
parent 01e4917acf
commit e127df3d6d
8 changed files with 57 additions and 16 deletions

View File

@@ -0,0 +1,28 @@
/** Публичные домены IdP (split-domain: API и SSO на разных хостах). */
export const PROJECT_API_HOST = 'api.idpmvk.lpr';
export const PROJECT_SSO_HOST = 'sso.idpmvk.lpr';
export const DEFAULT_PUBLIC_API_URL = `https://${PROJECT_API_HOST}`;
export const DEFAULT_PUBLIC_FRONTEND_URL = `https://${PROJECT_SSO_HOST}`;
export function inferApiBaseFromProjectDomain(domain: string): string | null {
const host = domain
.trim()
.replace(/^https?:\/\//i, '')
.split('/')[0]
.toLowerCase();
if (!host) {
return null;
}
if (host.startsWith('sso.')) {
return `https://${host.replace(/^sso\./, 'api.')}`;
}
if (host.startsWith('api.')) {
return `https://${host}`;
}
return null;
}