dotenv-config
Module that loads environment variables and verify their presence
How to use it
This module requires config
file that look like this:
config.json
and optionally .env
file with saved environment variables:
.env
HOST=localhostPORT=4000
Usage:
index.js
const config = ; console; // localhost moduleexports = config;
Additional settings
const config = ; const settings = envPath: '.env' // relative to project path configPath: 'config.json' // relative to project path; ;
Setting default routes
It is possible to change the default paths to config
and .env
by setting this environment variables:
DOTENV_CONFIG_ENVFILE=default/path/to/env/fileDOTENV_CONFIG_CONFIGFILE=default/path/to/config/file