Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.47 KB

File metadata and controls

53 lines (39 loc) · 1.47 KB

@omgjs/labkit-runtime-config

@omgjs/labkit-runtime-config contains small, framework-free parsing helpers for runtime configuration values.

The package deliberately parses values that are passed into it. It does not read process.env, import.meta.env, files, or deployment-provider state on its own.

Owns

  • Boolean parsing.
  • Number and finite-number parsing.
  • Comma-separated list parsing.
  • Consistent fallback handling for blank or missing values.

Does Not Own

  • Environment source selection.
  • Required-secret validation.
  • Deployment-provider mapping.
  • Server or browser framework integration.

Usage

import {
  parseBoolean,
  parseFiniteNumber,
  parseList,
} from "@omgjs/labkit-runtime-config";

const logReconnects = parseBoolean(env.VITE_GRAPHQL_LOG_RECONNECTS, false);
const watchdogMs = parseFiniteNumber(env.VITE_GRAPHQL_RECONNECT_WATCHDOG_MS, {
  fallback: 30_000,
  minimum: 1_000,
});
const allowedOrigins = parseList(env.CORS_ORIGIN);

Server packages usually wrap these helpers with a config reader. Browser packages usually pass Vite values from app-owned adapter files.

Release Channel

This package is published on npm as part of the Labkit release train. Patch releases may include documentation-only clarifications, so consumers can update within the same minor line without expecting runtime API changes.

Package Format

This package publishes both CommonJS and ESM entry points. Use the package root import; do not import from dist.