0.1.0 • Published 10 years ago

kb-config v0.1.0

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

#kb-config

Config helper for koa and koa-boot.

##Usage Standalone:

var conf = require('kb-config')({
  path:   __dirname + '/config',
  files:  [['*.js','!local.js'], 'local.js']
});

conf.get('database.connections.mysql.port');

With koa:

var
  app       = require('koa'),
  kbConfig  = require('kb-config');

kbConfig({
  app:    app
  path:   __dirname + '/config',
  files:  [['*.js','!local.js'], 'local.js']
});

app.config('database.connections.mysql.port');

With koa and koa-boot:

var
  app       = require('koa')(),
  koaBoot   = require('koa-boot'),
  kbConfig  = require('kb-config');

koaBoot()
.use(kbConfig.boot({
  path:   __dirname + '/config',
  files:  [['*.js','!local.js'], 'local.js']
}));
.boot(app)
.then(function (app) {
  app.config('database.connections.mysql.port');
});