1.0.1 • Published 8 years ago

cocobag v1.0.1

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
8 years ago

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.

1.0.1

8 years ago

1.0.0

8 years ago