mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 13:01:56 +00:00
refactor(ui): inline UI_CLOUD_ENABLED env name
- Drop the shared CLOUD_ENABLED_ENV constant, read the literal directly - Matches the neighboring CLOUD_BILLING_ENABLED usage; tsc still guards the name
This commit is contained in:
+2
-3
@@ -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.`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<RuntimePublicConfig> {
|
||||
"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.
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user