Creates merged config object after parsing dotenv and current env variables through javascript.
Supports ES5, ES7, AMD, CommonJS, System and ES6 modules.
Works in node.js also should(?) work in browser.
npm install --save @nod/environment
import { Environment } from '@nod/environment';
let environment = new Environment();
let { ENV, config, json } = environment;
//config is also environment variables but converted into object notation
console.log({ config, ENV, json });
import { Environment, Configuration as EnvConfig } from '@nod/environment';
import path from 'path';
let environment = new Environment(new EnvConfig {
silent : true, //should this.console.log issues like missing files or not
files : [ // files to look in the path
'.env.local',
'.env.production',
'.env.test',
'.env.development',
'.env',
'.env.nod'
],
root : path.resolve('.'), // root path for .env files
exclude : false //exclude with filter-object for json output
}, console //console and other deps can replaced);
gulp
or
npm run build
npm run watch
Please check available gulp tasks with:
gulp -T
All methods have strict type checking please check source code.
- Gulp tasks as another dependency
- More detailed docs
by NOD studios