Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,25 @@
|
||||
export type PluginRuntimeEnv = {
|
||||
[key: string]: string | undefined;
|
||||
NODE_ENV?: string;
|
||||
PLUGIN_RUNTIME_PRODUCTION_ENABLED?: string;
|
||||
};
|
||||
|
||||
export const PLUGIN_RUNTIME_PRODUCTION_GATE_ENV = "PLUGIN_RUNTIME_PRODUCTION_ENABLED";
|
||||
|
||||
export function isPluginRuntimeProductionEnabled(env: PluginRuntimeEnv = process.env): boolean {
|
||||
return env.NODE_ENV !== "production" || env.PLUGIN_RUNTIME_PRODUCTION_ENABLED === "true";
|
||||
}
|
||||
|
||||
export function describePluginRuntimeProductionGate(env: PluginRuntimeEnv = process.env): string | null {
|
||||
if (isPluginRuntimeProductionEnabled(env)) {
|
||||
return null;
|
||||
}
|
||||
return `${PLUGIN_RUNTIME_PRODUCTION_GATE_ENV}=true is required before tenant plugin runtime operations are allowed in production.`;
|
||||
}
|
||||
|
||||
export function assertPluginRuntimeProductionEnabled(env: PluginRuntimeEnv = process.env): void {
|
||||
const reason = describePluginRuntimeProductionGate(env);
|
||||
if (reason) {
|
||||
throw new Error(reason);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user