Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcoin-org/bcfg
Config parser for bcoin
https://github.com/bcoin-org/bcfg
Last synced: 6 days ago
JSON representation
Config parser for bcoin
- Host: GitHub
- URL: https://github.com/bcoin-org/bcfg
- Owner: bcoin-org
- License: other
- Created: 2017-10-29T15:13:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-31T10:23:49.000Z (about 1 year ago)
- Last Synced: 2024-10-08T13:53:11.896Z (about 1 month ago)
- Language: JavaScript
- Size: 47.9 KB
- Stars: 6
- Watchers: 8
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bcfg
Config parser (used for bcoin).
## Usage
``` js
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. ``## License
- Copyright (c) 2017, Christopher Jeffrey (MIT License).
See LICENSE for more info.