1.0.0 • Published 10 years ago

conman v1.0.0

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

Conman

Configuration manager for Hapi.js.

var Hapi = require('hapi');

var server = new Hapi.Server(80);
server.require('conman', { configPath: '/path/to/configs' }, function (err) {
  if (err) {
    throw err;
  }
});

In handler:

var value = server.plugins.conman.get('key.of.config.item', 'default value');

Configs

The configs is a group of YAML files. When initializing Conman all the files in configPath will be loaded and merged into one object. A file named config.yaml will always be loaded last. This allow overriding stuff in production or development.

Objects in your configuration can be traversed using a keypath where keys are separated by .. If value was not found in config defaultValue or null will be returned.