Skip to main content

apps/gateway/src/config/env.ts

Metadata

Indexed Symbols

  • parseNodeEnv (line 7, function) - Implements parse node env for module behavior.
  • parseAuthMode (line 14, function) - Implements parse auth mode for module behavior.
  • parseInteger (line 21, function) - Implements parse integer for module behavior.
  • parseBoolean (line 32, function) - Implements parse boolean for module behavior.
  • parseCorsOrigins (line 39, function) - Implements parse cors origins for module behavior.
  • parseResourceEncryptionKey (line 49, function) - Implements parse resource encryption key for module behavior.
  • parseOptionalUrl (line 60, function) - Implements parse optional url for module behavior.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

type AuthMode = "disabled" | "jwt";
type NodeEnv = "development" | "test" | "staging" | "production";

const DEFAULT_JWT_SECRET = "dev-jwt-secret";
const DEFAULT_AUDIT_SECRET = "dev-audit-signing-secret";

function parseNodeEnv(value: string | undefined): NodeEnv {
if (value === "production" || value === "staging" || value === "test") {
return value;
}
return "development";
}

function parseAuthMode(value: string | undefined): AuthMode {
if (value === "jwt") {
return "jwt";
}
return "disabled";
}

function parseInteger(value: string | undefined, fallback: number, name: string): number {
if (!value) {
return fallback;
}
const parsed = Number(value);