https://github.com/tableflip/joi-ipfs-config
Validate JS-IPFS config
https://github.com/tableflip/joi-ipfs-config
Last synced: about 1 year ago
JSON representation
Validate JS-IPFS config
- Host: GitHub
- URL: https://github.com/tableflip/joi-ipfs-config
- Owner: tableflip
- License: mit
- Created: 2018-02-28T12:18:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T13:50:16.000Z (over 8 years ago)
- Last Synced: 2025-02-15T12:46:47.496Z (over 1 year ago)
- Language: JavaScript
- Size: 209 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# joi-ipfs-config
[](https://travis-ci.org/tableflip/joi-ipfs-config)
[](https://david-dm.org/tableflip/joi-ipfs-config)
[](https://standardjs.com)
> Validate JS-IPFS config
Your flexible IPFS config validating friend. The following rationale is applied here:
1. 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
2. Where a config value is an object, we allow `null` to be passed in its place
3. We are not in charge of defaults, that is for the module that uses the option to decide
## Install
```sh
npm install joi-ipfs-config
```
## Usage
```js
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](https://github.com/tableflip/joi-ipfs-config/issues/new) or submit PRs.
## License
[MIT](LICENSE) © Alan Shaw