@korzun/config
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Config

npm version

Easy Application Configuration Using Environment Variables

Installation

npm i @korzun/config

or

yarn add @korzun/config

Example

// config.ts
import { getBoolean, getNumber, getString } from '@korzun/config';

export const log = {
  enableColors: getBoolean('LOG_ENABLE_COLORS', {
    default: true
  }),
  flushFrequency: getNumber('LOG_FLUSH_DURATION', {
    allowRange: [500, 10_000],
    default: 1000
  }), 
  level: getString('LOG_LEVEL', {
    allowList: ['debug', 'info', 'warn', 'error', 'disabled'],
    default: 'error'
  }),
  transport: getString('LOG_TRANSPORT', {
    allowList: ['file', 'http', 'log'],
    allowUndefined: true,
  }),
};

/@korzun/config/

    Package Sidebar

    Install

    npm i @korzun/config

    Weekly Downloads

    4

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    80.1 kB

    Total Files

    40

    Last publish

    Collaborators

    • korzun