Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pubsub default config #393

Merged
merged 3 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/libp2p-in-the-browser/1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"detect-dom-ready": "^1.0.2",
"libp2p": "../../../",
"libp2p-bootstrap": "~0.9.7",
"libp2p-gossipsub": "~0.0.4",
"libp2p-kad-dht": "^0.15.3",
"libp2p-mplex": "~0.8.5",
"libp2p-secio": "~0.11.1",
Expand Down
8 changes: 5 additions & 3 deletions examples/libp2p-in-the-browser/1/src/browser-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const SPDY = require('libp2p-spdy')
const SECIO = require('libp2p-secio')
const Bootstrap = require('libp2p-bootstrap')
const DHT = require('libp2p-kad-dht')
const Gossipsub = require('libp2p-gossipsub')
const libp2p = require('libp2p')

// Find this list at: https://github.com/ipfs/js-ipfs/blob/master/src/core/runtime/config-browser.json
Expand Down Expand Up @@ -48,7 +49,8 @@ class Node extends libp2p {
wsstar.discovery,
Bootstrap
],
dht: DHT
dht: DHT,
pubsub: Gossipsub
},
config: {
peerDiscovery: {
Expand All @@ -75,8 +77,8 @@ class Node extends libp2p {
dht: {
enabled: false
},
EXPERIMENTAL: {
pubsub: false
pubsub: {
enabled: false
}
},
connectionManager: {
Expand Down
8 changes: 3 additions & 5 deletions examples/pubsub/1.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const Mplex = require('libp2p-mplex')
const SECIO = require('libp2p-secio')
const PeerInfo = require('peer-info')
const MulticastDNS = require('libp2p-mdns')
const Gossipsub = require('libp2p-gossipsub')
const defaultsDeep = require('@nodeutils/defaults-deep')
const waterfall = require('async/waterfall')
const parallel = require('async/parallel')
const series = require('async/series')

class MyBundle extends libp2p {
constructor (_options) {
Expand All @@ -19,17 +19,15 @@ class MyBundle extends libp2p {
transport: [ TCP ],
streamMuxer: [ Mplex ],
connEncryption: [ SECIO ],
peerDiscovery: [ MulticastDNS ]
peerDiscovery: [ MulticastDNS ],
pubsub: Gossipsub
},
config: {
peerDiscovery: {
mdns: {
interval: 2000,
enabled: true
}
},
EXPERIMENTAL: {
pubsub: true
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const configSchema = s({
}),
// Pubsub config
pubsub: s('object?', {
// DHT defaults
enabled: false
// Pubsub defaults
enabled: true
})
}, {})

Expand Down
6 changes: 3 additions & 3 deletions test/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('configuration', () => {
autoDial: true
},
pubsub: {
enabled: false
enabled: true
},
dht: {
kBucketSize: 20,
Expand Down Expand Up @@ -145,7 +145,7 @@ describe('configuration', () => {
}
},
pubsub: {
enabled: false
enabled: true
},
dht: {
kBucketSize: 20,
Expand Down Expand Up @@ -270,7 +270,7 @@ describe('configuration', () => {
},
config: {
pubsub: {
enabled: false
enabled: true
},
peerDiscovery: {
autoDial: true
Expand Down