tableflip/joi-ipfs-config

Name: joi-ipfs-config

Owner: TABLEFLIP

Description: Validate JS-IPFS config

Created: 2018-02-28 12:18:44.0

Updated: 2018-02-28 12:56:17.0

Pushed: 2018-02-28 13:50:16.0

Homepage: null

Size: 214

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

joi-ipfs-config

Build Status dependencies Status JavaScript Style Guide

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
install joi-ipfs-config
Usage
t Joi = require('joi').extend(require('joi-ipfs-config'))

t config = {
nfig: {
Addresses: {
  Swarm: [
    '/ip4/0.0.0.0/tcp/4002',
    '/ip4/127.0.0.1/tcp/4003/ws'
  ]
}

PERIMENTAL: {
pubsub: true,
dht: true



attempt(config, Joi.ipfsConfig()) // throws if invalid
Contribute

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Alan Shaw


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.