Zero dependency configuration module. Because using configuration with bare dotenv does not work with default values nor type checking.
- 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.
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.