cocobag

1.0.1 • Public • Published

cocobag Logo

Cocobag

Build Status

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.

Readme

Keywords

Package Sidebar

Install

npm i cocobag

Weekly Downloads

4

Version

1.0.1

License

GPL-3.0

Last publish

Collaborators

  • ndufreche