Each tenant config now includes oidcClientId. Auth composable reads client ID from tenant config instead of hardcoded fallback. Dev tenant uses restricted Zitadel project (role-check enabled, developer grant). Added NODE_ENV=production to env files to fix --mode dev builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
/**
|
|
* 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<string, { default: TenantConfig }> = 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;
|