Please refer to hapijs/confidence for the details.
- config.js
const confidenceProxyHandler = require('confidence-proxy');
module.exports = new Proxy({
/* confidence document */
foo: {
$filter: 'asd'
$default: {
bar: 'A'
}
}
}, confidenceProxyHandler);
- foo.js
const config = require('./config');
console.log(config.foo.bar); //A
// TODO
- Support VS Code's autocompletion for the properties. Awesome!
// TODO
- add test codes
- custom criteria: now it always use
process.env
- // add more TODO