2431451cef
Build & Deploy to K8s / build-and-deploy (push) Successful in 4m30s
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
38 lines
838 B
TypeScript
38 lines
838 B
TypeScript
/**
|
|
* 테넌트 서브도메인 헬퍼.
|
|
* 메인 사이트(solution, www, admin 등 예약어) 는 null 을 리턴해서
|
|
* TenantGuard 가 체크를 스킵하게 한다.
|
|
*
|
|
* 백엔드 provisioning 의 RESERVED_SUBDOMAINS 와 같은 값을 유지할 것.
|
|
*/
|
|
const RESERVED_MAIN = new Set([
|
|
"solution",
|
|
"www",
|
|
"admin",
|
|
"api",
|
|
"app",
|
|
"static",
|
|
"assets",
|
|
"main",
|
|
"mail",
|
|
"blog",
|
|
"test",
|
|
"staging",
|
|
"prod",
|
|
"console",
|
|
]);
|
|
|
|
export function extractTenantSubdomain(host: string): string | null {
|
|
if (!host) return null;
|
|
|
|
const cleanHost = host.split(":")[0].toLowerCase();
|
|
if (!cleanHost.endsWith(".invyone.com")) return null;
|
|
|
|
const prefix = cleanHost.substring(0, cleanHost.length - ".invyone.com".length);
|
|
if (!prefix) return null;
|
|
|
|
if (RESERVED_MAIN.has(prefix)) return null;
|
|
|
|
return prefix;
|
|
}
|