@overbounce/config
v1.0.3
Published
Zero dependency configuration module. Because using configuration with bare dotenv does not work with default values nor type checking.
Downloads
15
Readme
Config
Zero dependency configuration module. Because using configuration with bare dotenv does not work with default values nor type checking.
How it works
- You register configuration key with
.register(key, type, default); - The module checks if an environment variable "key" or "KEY" exists and overrides the default value if so ;
- 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.
