ara-runtime-configuration
v2.0.1
Published
ARA Runtime Configuration (.ararc)
Downloads
59
Readme
ara-runtime-configuration
Ara Runtime Configuration (Reads from the nearest
.ararc
file.)
Status
Stable
Installation
$ npm install arablocks/ara-runtime-configuration
Usage
To load Runtime Configuration for any Ara related modules, simply
require this module and call the default exported function. You can pass
an object specifying default values that may not be present in an .ararc
const rc = require('ara-runtime-configuration')
const conf = rc({
network: { node: { dns: { multicast: false } } }
})
[web3]
provider = ws://127.0.0.1:8546
[network.identity]
keyring = /home/vipyne/.ara/keyring
root = /home/vipyne/.ara/identities
Example
Example .ararc
API
const conf = rc(conf, name)
Load runtime configuration defined in the nearest .ararc
file on disk
optionally specifying defaults.
conf
- Optional default configuration object or function. Ifconf
is a function, it will be passed the base runtime config object.name
- Optional name to override defaultara
rc name
araconf(1)
araconf
is a tool for quickly reading values in the closest
configuration file. It uses
json-select to support
JSONPath queries.
Usage
araconf
can be used directly from command line. It accepts a single
optional JSONPath query and emits valid JSON to stdout.
usage: araconf [-hV] [options] [query]
Options:
-D, --debug Enable debug output [boolean]
-h, --help Show help [boolean]
-V, --version Show version number [boolean]
Examples
Running without a query:
$ araconf
{
"network": {
"identity": {}
},
"data": {
"root": "/home/werle/.ara"
},
"web3": {
"provider": "http://127.0.0.1:8545"
}
}
Targeting the .data
object of the conf:
$ araconf .data
{
"root": "/home/werle/.ara"
}
Targeting the .web3.provider
property:
$ araconf .web3.provider
"http://127.0.0.1:8545"
Enable debug output with --debug
:
$ araconf .data.root --debug
ara-runtime-configuration config: /home/werle/.ararc +0ms
ara-runtime-configuration configs: [ '/home/werle/.ararc' ] +2ms
"/home/werle/.ara"
Contributing
Releases follow Semantic Versioning
See Also
License
LGPL-3.0