/** * tenant.ts — Build-time tenant configuration * * VITE_TENANT selects which tenant config to load. * Direct dynamic import ensures only the active tenant is bundled. */ export interface TenantFeatures { graph: boolean; trace: boolean; viewer: boolean; devTools: boolean; } export interface TenantConfig { id: string; name: string; domain: string; defaultTheme: string; oidcClientId: string; features: TenantFeatures; } // Vite replaces import.meta.env.VITE_TENANT at build time, // making the import path a string literal → only one tenant bundled. const modules: Record = import.meta.glob('../tenants/*/config.ts', { eager: true }); const tenantId = import.meta.env.VITE_TENANT || 'loop42'; const key = `../tenants/${tenantId}/config.ts`; const mod = modules[key]; if (!mod) { throw new Error(`Unknown tenant: ${tenantId}. Available: ${Object.keys(modules).join(', ')}`); } const config: TenantConfig = mod.default; export default config;