Config parser for @lumeweb/relay
Go to file
Derrick Hammer 2a1078a3a2
*Update dist
2022-12-19 13:49:11 -05:00
dist *Update dist 2022-12-19 13:49:11 -05:00
src *improve object path check 2022-12-19 13:48:39 -05:00
test config: pass and filter JSON options to child 2021-09-28 13:11:08 -04:00
.eslintrc.json bcfg: pkg: upgrade deps. update ignore and rc files. 2019-03-21 12:02:55 -07:00
.gitignore bcfg: pkg: upgrade deps. update ignore and rc files. 2019-03-21 12:02:55 -07:00
.npmignore bcfg: pkg: upgrade deps. update ignore and rc files. 2019-03-21 12:02:55 -07:00
LICENSE *Initial port to typescript 2022-09-21 14:16:00 -04:00
README.md pkg: fix readme. 2017-12-27 22:44:56 -08:00
package.json *Update dep 2022-12-19 11:29:59 -05:00
tsconfig.json *add type defs 2022-09-21 15:54:40 -04: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.