diff --git a/ui/lib/env.ts b/ui/lib/env.ts index 9592db3410..791715afb2 100644 --- a/ui/lib/env.ts +++ b/ui/lib/env.ts @@ -2,7 +2,6 @@ import { assertGatedIntegrations, warnGatedIntegrationsMisconfig, } from "@/lib/integrations"; -import { CLOUD_ENABLED_ENV } from "@/lib/runtime-config.shared"; import { readBoolEnv, readEnv } from "@/lib/runtime-env"; // Boot-time required-env assertion so a misconfigured container fails fast @@ -42,7 +41,7 @@ warnGatedIntegrationsMisconfig(); // The billing UI is Cloud-only: navigation (navigation-config.ts) and the // /billing route (proxy.ts) additionally gate on the cloud flag, so billing // enabled without it is inert — warn, don't throw. -const cloudEnabled = readBoolEnv(CLOUD_ENABLED_ENV); +const cloudEnabled = readBoolEnv("UI_CLOUD_ENABLED"); const cloudBillingSelector = readEnv("CLOUD_BILLING_ENABLED"); const cloudBillingOn = cloudBillingSelector !== null && cloudBillingSelector !== "false"; @@ -50,7 +49,7 @@ const cloudBillingOn = if (cloudBillingOn && !cloudEnabled) { // eslint-disable-next-line no-console console.warn( - `CLOUD_BILLING_ENABLED is "${cloudBillingSelector}" but ${CLOUD_ENABLED_ENV} is not "true"; the billing UI will not be shown.`, + `CLOUD_BILLING_ENABLED is "${cloudBillingSelector}" but UI_CLOUD_ENABLED is not "true"; the billing UI will not be shown.`, ); } diff --git a/ui/lib/runtime-config.shared.ts b/ui/lib/runtime-config.shared.ts index 067f1612cd..11aa25e52d 100644 --- a/ui/lib/runtime-config.shared.ts +++ b/ui/lib/runtime-config.shared.ts @@ -17,11 +17,6 @@ export interface RuntimePublicConfig { export const RUNTIME_CONFIG_SCRIPT_ID = "__PROWLER_RUNTIME_CONFIG__"; -// Env var for the Prowler Cloud flag; shared so the island producer -// (lib/runtime-config.ts), the isCloud() env fallback (lib/shared/env.ts) -// and the boot checks (lib/env.ts) can never drift. -export const CLOUD_ENABLED_ENV = "UI_CLOUD_ENABLED" as const; - // All-null fallback (SSR or parse failure). export const EMPTY_RUNTIME_PUBLIC_CONFIG: RuntimePublicConfig = { sentryDsn: null, diff --git a/ui/lib/runtime-config.ts b/ui/lib/runtime-config.ts index 0120051be5..889b375ce6 100644 --- a/ui/lib/runtime-config.ts +++ b/ui/lib/runtime-config.ts @@ -3,10 +3,7 @@ import "server-only"; import { connection } from "next/server"; import { readGatedEnv } from "@/lib/integrations"; -import { - CLOUD_ENABLED_ENV, - type RuntimePublicConfig, -} from "@/lib/runtime-config.shared"; +import { type RuntimePublicConfig } from "@/lib/runtime-config.shared"; import { readBoolEnv, readEnv } from "@/lib/runtime-env"; // `connection()` forces a per-request runtime read (never build-snapshotted); @@ -47,7 +44,7 @@ export async function getRuntimePublicConfig(): Promise { "POSTHOG_HOST", ), reoDevClientId: readEnv("REO_DEV_CLIENT_ID"), - cloudEnabled: readBoolEnv(CLOUD_ENABLED_ENV), + cloudEnabled: readBoolEnv("UI_CLOUD_ENABLED"), // Install-level selector "legacy" | "metronome" | "false"; the client only // needs on/off, so expose a derived boolean (the raw selector is read // server-side for V1/V2 routing). Default (unset) is off. diff --git a/ui/lib/shared/env.ts b/ui/lib/shared/env.ts index 9adbacc420..398822bd02 100644 --- a/ui/lib/shared/env.ts +++ b/ui/lib/shared/env.ts @@ -1,10 +1,7 @@ /** * Shared environment helpers. */ -import { - CLOUD_ENABLED_ENV, - readRuntimeConfigIsland, -} from "@/lib/runtime-config.shared"; +import { readRuntimeConfigIsland } from "@/lib/runtime-config.shared"; import { readBoolEnv } from "@/lib/runtime-env"; /** @@ -21,5 +18,5 @@ export function isCloud(): boolean { const islandConfig = readRuntimeConfigIsland(); if (islandConfig) return islandConfig.cloudEnabled; - return readBoolEnv(CLOUD_ENABLED_ENV); + return readBoolEnv("UI_CLOUD_ENABLED"); }