A package to load configuration options
The package exports a class that can be instantiated to read configuration files from any directory. Documentation can be found here.
const path = require('path');
const config = require('quture-config')({
configDir: path.join(__dirname, 'config')
});
//
// ./config/app.js
// module.exports = {
// someValue: 'hello world!'
// }
let hasSomeValue = config.has('app.someValue');
if (hasSomeValue) {
// true
} else {
// false
}
let actualSomeValue = config.get('app.someValue');
console.log(actualSomeValue);
// 'hello world!'
let valueThatDoesntExist = config.get('app.valueThatDoesntExist', 'This will be returned as the default value instead');
console.log(valueThatDoesntExist);
// 'This will be returned as the default value instead'
let valueThatReallyDoesntExist = config.get('app.valueThatDoesntExist');
console.log(valueThatReallyDoesntExist);
// null