mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 04:21:52 +00:00
7d2a22c45a
Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com> Co-authored-by: César Arroba <19954079+cesararroba@users.noreply.github.com>
23 lines
847 B
TypeScript
23 lines
847 B
TypeScript
/**
|
|
* Shared environment helpers.
|
|
*/
|
|
import { readRuntimeConfigIsland } from "@/lib/runtime-config.shared";
|
|
import { readBoolEnv } from "@/lib/runtime-env";
|
|
|
|
/**
|
|
* Whether the UI is running inside a Prowler Cloud deployment.
|
|
*
|
|
* Runtime read, resolved from two sources:
|
|
* - Browser: the runtime public-config island (`cloudEnabled`), rendered in
|
|
* <head> before any bundle runs, so calling this at module scope is safe.
|
|
* - Without a DOM (RSC, server actions, SSR, edge, Node) and jsdom tests
|
|
* without an island: `UI_CLOUD_ENABLED`. The island is produced from the
|
|
* same env var (lib/runtime-config.ts), so SSR and hydration always agree.
|
|
*/
|
|
export function isCloud(): boolean {
|
|
const islandConfig = readRuntimeConfigIsland();
|
|
if (islandConfig) return islandConfig.cloudEnabled;
|
|
|
|
return readBoolEnv("UI_CLOUD_ENABLED");
|
|
}
|