Skip to content

@edgetime/config

Strict boolean flags and required variables for configuration passed as text. No dependencies.

npm install @edgetime/config

Readers for configuration passed as text variables. No dependencies.

import { flag, required } from '@edgetime/config';
const issuer = required(env, 'JWT_ISSUER');
const replicaOn = flag(env.REPLICA_ENABLED);
  • flag(value, fallback = false) accepts only true and false. An unset or empty value takes the fallback. Anything else throws, so a typo fails loudly instead of switching a feature off.
  • required(env, name) returns a non-empty string variable and throws <name> is not configured when it is missing.

Read configuration once, where the application’s dependencies are assembled, and pass the results on as values. Route code then never parses a variable.


Source: packages/config on GitHub.