/ opencodehub / src / lib / air-gapped.ts
Swadhin Biswas feat(api): add runner, analytics, packages, and security services · 3/6/2026
28f7954
16 lines · 467 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export function isAirGappedMode(): boolean {
  const value = (process.env.AIR_GAPPED_MODE || "").trim().toLowerCase();
  return value === "1" || value === "true" || value === "yes";
}

export function getAirGappedMessage(feature: string): string {
  return `${feature} is disabled because AIR_GAPPED_MODE is enabled`;
}

export function assertOnlineFeature(feature: string): void {
  if (isAirGappedMode()) {
    throw new Error(getAirGappedMessage(feature));
  }
}