cocobag
v1.0.1
Published
configuration manager for hapi based on nconf
Downloads
3
Readme
Cocobag
Cocobag aggregate all config files.
Cocobag expose "bag" variable who is a nconf object into hapi server. It supports YAML, JSON, JS modules and folder.
Installation
npm install cocobag --save
Initialization
const Hapi = require('hapi');
const Path = require('path');
server = new Hapi.Server();
server.connection();
server.register({
register: require('cocobag'),
options: {
defaults: [ // the defaults configurations
Path.join(__dirname, 'default'),
Path.join(__dirname, 'default2')
],
paths: [ // your environment configurations
Path.join(__dirname, 'environment')
]
}
}, (err) => {
if (err) {
throw err
}
// now you can access to the bag variable.
server.bag.get('my:config:variable')
})
Interface
See nconf's API.