@nod/environment
v4.6.1
Published
Creates merged config object after parsing dotenv and current env variables
Downloads
9
Readme
@nod/environment
Creates merged config object after parsing dotenv and current env variables through javascript.
Supports ES5, ES7, AMD, CommonJS, System and ES6 modules.
Platform
Works in node.js also should(?) work in browser.
Usage:
Installation:
npm install --save @nod/environment
Examples:
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 });
Configuring
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);
Build and develop:
gulp
or
npm run build
npm run watch
Please check available gulp tasks with:
gulp -T
API
All methods have strict type checking please check source code.
ToDo:
- Gulp tasks as another dependency
- More detailed docs
Contact:
by NOD studios