Config parser for @lumeweb/relay
Go to file
Christopher Jeffrey 9d2439cdf4
pkg: minor.
2018-06-11 20:02:55 -07:00
lib pkg: update deps. 2017-12-29 12:54:12 -08:00
.babelrc bcfg: first commit. 2017-10-29 07:08:10 -07:00
.eslintrc.json bcfg: first commit. 2017-10-29 07:08:10 -07:00
.gitignore bcfg: first commit. 2017-10-29 07:08:10 -07:00
.npmignore pkg: .npmignore. 2017-11-02 08:04:52 -07:00
LICENSE v0.0.1 2017-12-29 15:09:50 -08:00
Makefile bcfg: first commit. 2017-10-29 07:08:10 -07:00
README.md pkg: fix readme. 2017-12-27 22:44:56 -08:00
package.json pkg: minor. 2018-06-11 20:02:55 -07:00
webpack.config.js bcfg: first commit. 2017-10-29 07:08:10 -07:00

README.md

bcfg

Config parser (used for bcoin).

Usage

const Config = require('bcfg');

// Will consider ~/.my-module the prefix directory.
const config = new Config('my-module', {
  alias: {
    'n': 'network'
  }
});

// Inject some custom options first.
config.inject({
  some: 'user',
  options: 'here'
});

config.load({
  // Parse URL hash
  hash: true,
  // Parse querystring
  query: true,
  // Parse environment
  env: true,
  // Parse args
  argv: true
});

// Will parse ~/.my-module/my-config.conf (throws on FS error).
config.open('my-config.conf');

// These will cast types and throw on incorrect type.
console.log(config.str('username'));
console.log(config.str('password'));
console.log(config.uint('userid'));
console.log(config.float('percent'));
console.log(config.bool('initialize'));

Contribution and License Agreement

If you contribute code to this project, you are implicitly allowing your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work. </legalese>

License

  • Copyright (c) 2017, Christopher Jeffrey (MIT License).

See LICENSE for more info.