Skip to content

hapipip/cocobag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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')
    ],
    overrides: [ // 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.

About

Cocobag aggregate all config files for Hapijs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published