Files
prowler/ui/lib/env.ts
T
Pablo Fernandez Guerra (PFE) ac3f289de6 feat(ui): gate Sentry, GTM and PostHog behind runtime enable flags (#11682)
Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 13:43:34 +02:00

29 lines
760 B
TypeScript

import {
assertGatedIntegrations,
warnGatedIntegrationsMisconfig,
} from "@/lib/integrations";
import { readEnv } from "@/lib/runtime-env";
// Boot-time required-env assertion so a misconfigured container fails fast
// with a clear message. A key with a deprecated legacy name is satisfied by
// either name (see readEnv).
const REQUIRED: ReadonlyArray<{
key: keyof NodeJS.ProcessEnv;
legacy?: keyof NodeJS.ProcessEnv;
}> = [
{ key: "UI_API_BASE_URL", legacy: "NEXT_PUBLIC_API_BASE_URL" },
{ key: "AUTH_URL" },
{ key: "AUTH_SECRET" },
];
for (const { key, legacy } of REQUIRED) {
if (!readEnv(key, legacy)) {
throw new Error(`Missing required env: ${key}`);
}
}
assertGatedIntegrations();
warnGatedIntegrationsMisconfig();
export {};