kb-config
Config helper for koa and koa-boot
Last updated 6 years ago by cahnory .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install kb-config 
SYNC missed versions from official npm registry.

#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');
});

Current Tags

  • 0.1.0                                ...           latest (6 years ago)

1 Versions

  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |