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

1.0.3 • Public • Published

Config

Zero dependency configuration module. Because using configuration with bare dotenv does not work with default values nor type checking.

How it works

  1. You register configuration key with .register(key, type, default) ;
  2. The module checks if an environment variable "key" or "KEY" exists and overrides the default value if so ;
  3. You use .get(key) to get the value.

Example

import { Config } from '@overbounce/config'
import dotenv from 'dotenv'

dotenv.config();
Config.register('port', 'integer', 80);
console.log(Config.get('port'));

You can also not use the dotenv plugin.

Readme

Keywords

none

Package Sidebar

Install

npm i @overbounce/config

Weekly Downloads

0

Version

1.0.3

License

none

Unpacked Size

4.02 kB

Total Files

4

Last publish

Collaborators

  • willjouo