joi-ipfs-config
v1.0.2
Published
Validate js-ipfs config
Downloads
6
Maintainers
Readme
joi-ipfs-config
Validate JS-IPFS config
Your flexible IPFS config validating friend. The following rationale is applied here:
- This project shouldn't block new features landing in JS-IPFS. Object validation allows for unknown keys so that the feature can land, and validation for the config can be backfilled at a later date
- Where a config value is an object, we allow
null
to be passed in its place - We are not in charge of defaults, that is for the module that uses the option to decide
Install
npm install joi-ipfs-config
Usage
const Joi = require('joi').extend(require('joi-ipfs-config'))
const config = {
config: {
Addresses: {
Swarm: [
'/ip4/0.0.0.0/tcp/4002',
'/ip4/127.0.0.1/tcp/4003/ws'
]
}
},
EXPERIMENTAL: {
pubsub: true,
dht: true
}
}
Joi.attempt(config, Joi.ipfsConfig()) // throws if invalid
Contribute
Feel free to dive in! Open an issue or submit PRs.
License
MIT © Alan Shaw