Files
cameleer-saas/ui/src/config.ts
hsiegeln 4997f7a6a9
All checks were successful
CI / build (push) Successful in 48s
CI / docker (push) Successful in 41s
feat: move SaaS app to /platform base path, Logto becomes catch-all
Eliminates all Logto path enumeration in Traefik. Routing is now:
- /platform/* → cameleer-saas (SPA + API)
- /server/* → server-ui
- /* (catch-all) → Logto (sign-in, OIDC, assets, everything)

Spring context-path handles backend prefix transparently. No changes
needed in controllers, SecurityConfig, or interceptors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 23:06:41 +02:00

43 lines
1023 B
TypeScript

interface AppConfig {
logtoEndpoint: string;
logtoClientId: string;
logtoResource: string;
scopes: string[];
}
let cached: AppConfig | null = null;
export async function fetchConfig(): Promise<AppConfig> {
if (cached) return cached;
try {
const response = await fetch('/platform/api/config');
if (response.ok) {
cached = await response.json();
return cached!;
}
} catch {
// Config endpoint not available (e.g., Vite dev without backend)
}
// Fallback to env vars (Vite dev mode)
cached = {
logtoEndpoint: import.meta.env.VITE_LOGTO_ENDPOINT || window.location.origin,
logtoClientId: import.meta.env.VITE_LOGTO_CLIENT_ID || '',
logtoResource: import.meta.env.VITE_LOGTO_RESOURCE || '',
scopes: [
'platform:admin',
'tenant:manage',
'billing:manage',
'team:manage',
'apps:manage',
'apps:deploy',
'secrets:manage',
'observe:read',
'observe:debug',
'settings:manage',
],
};
return cached;
}