exp-cfg

0.0.1 • Public • Published

bcfg

Config parser (used for bcoin).

Usage

const bcfg = require('bcfg');
 
const config = bcfg('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.

Dependencies (0)

    Dev Dependencies (10)

    Package Sidebar

    Install

    npm i exp-cfg

    Weekly Downloads

    9

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • rojikku0xff