1.2.0 • Published 3 years ago
@dukai.net/config v1.2.0
Simple configuration management
Installation:
npm install @dukai.net/config
or
yarn add @dukai.net/config
Use:
// Set the NODE_ENV environment value
process.env.NODE_ENV = 'development';
const config = require('@dukai.net/config'); // Loads the default.json and combine it with development.json
// Reloads default.json and combines it with test.json
config.init('test');
// Access properties directly
const val1 = config.beta.delta;
// Alternatively gets the property by name
const val2 = config.get('beta.delta');
// Compare
if (val1 === val2) {
console.log('Yes it is the same');
}