Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit a30d22d

Browse files
committed
chore: address review
1 parent 011827d commit a30d22d

File tree

16 files changed

+35
-30
lines changed

16 files changed

+35
-30
lines changed

examples/circuit-relaying/src/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ document.addEventListener('DOMContentLoaded', async () => {
3636
enabled: true // make this node a relay (HOP)
3737
}
3838
},
39-
EXPERIMENTAL: {
40-
pubsub: true // enable pubsub
39+
pubsub: {
40+
enabled: true
4141
},
4242
config: {
4343
Bootstrap: []

examples/custom-libp2p/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ const libp2pBundle = (opts) => {
9696
timeout: 2e3 // End the query quickly since we're running so frequently
9797
}
9898
},
99-
EXPERIMENTAL: {
100-
pubsub: true
99+
pubsub: {
100+
enabled: true
101101
}
102102
}
103103
})

examples/exchange-files-in-browser/public/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ let info
4444
async function start () {
4545
if (!node) {
4646
const options = {
47-
EXPERIMENTAL: {
48-
pubsub: true
47+
pubsub: {
48+
enabled: true
4949
},
5050
repo: 'ipfs-' + Math.random(),
5151
config: {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
"form-data": "^2.5.1",
196196
"hat": "0.0.3",
197197
"interface-ipfs-core": "^0.111.0",
198-
"ipfsd-ctl": "^0.44.1",
198+
"ipfsd-ctl": "ipfs/js-ipfsd-ctl#fix/pubsub-flag-defaults",
199199
"libp2p-websocket-star": "~0.10.2",
200200
"ncp": "^2.0.0",
201201
"p-event": "^4.1.0",

src/cli/commands/daemon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
type: 'boolean',
1717
default: false
1818
})
19-
.option('enable-pubsub-experiment', {
19+
.option('enable-pubsub', {
2020
type: 'boolean',
2121
default: false
2222
})
@@ -53,8 +53,8 @@ module.exports = {
5353
offline: argv.offline,
5454
pass: argv.pass,
5555
preload: { enabled: argv.enablePreload },
56+
pubsub: { enabled: argv.enablePubsub },
5657
EXPERIMENTAL: {
57-
pubsub: argv.enablePubsubExperiment,
5858
ipnsPubsub: argv.enableNamesysPubsub,
5959
dht: argv.enableDhtExperiment,
6060
sharding: argv.enableShardingExperiment

src/cli/daemon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Daemon {
3030
async start () {
3131
this._log('starting')
3232

33-
const libp2p = { modules: {} }
33+
const libp2p = { modules: {}, config: {} }
3434

3535
// Attempt to use any of the WebRTC versions available globally
3636
let electronWebRTC

src/cli/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ exports.getIPFS = (argv, callback) => {
5050
init: false,
5151
start: false,
5252
pass: argv.pass,
53-
EXPERIMENTAL: {
54-
pubsub: true
53+
pubsub: {
54+
enabled: true
5555
}
5656
})
5757

src/core/components/libp2p.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) {
119119
}
120120
},
121121
pubsub: {
122-
enabled: get(options, 'EXPERIMENTAL.pubsub', false)
122+
enabled: get(options, 'pubsub.enabled', false)
123123
}
124124
},
125125
connectionManager: get(options, 'connectionManager',

src/core/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const configSchema = s({
3232
addresses: optional(s(['multiaddr'])),
3333
interval: 'number?'
3434
}, { enabled: true, interval: 30 * 1000 }),
35+
pubsub: optional(s({
36+
enabled: 'boolean?'
37+
})),
3538
init: optional(union(['boolean', s({
3639
bits: 'number?',
3740
emptyRepo: 'boolean?',

src/core/index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const multihashing = require('multihashing-async')
1515
const CID = require('cids')
1616
const debug = require('debug')
1717
const mergeOptions = require('merge-options')
18+
const get = require('dlv')
1819
const EventEmitter = require('events')
1920

2021
const config = require('./config')
@@ -46,6 +47,9 @@ class IPFS extends EventEmitter {
4647
init: true,
4748
start: true,
4849
EXPERIMENTAL: {},
50+
pubsub: {
51+
enabled: false
52+
},
4953
preload: {
5054
enabled: true,
5155
addresses: [
@@ -131,13 +135,14 @@ class IPFS extends EventEmitter {
131135
this.stats = components.stats(this)
132136
this.resolve = components.resolve(this)
133137

134-
if (this._options.EXPERIMENTAL.pubsub) {
135-
this.log('EXPERIMENTAL pubsub is enabled')
138+
if (this._options.pubsub.enabled) {
139+
this.log('pubsub is enabled')
136140
}
137141
if (this._options.EXPERIMENTAL.ipnsPubsub) {
138-
if (!this._options.EXPERIMENTAL.pubsub) {
139-
this.log('EXPERIMENTAL pubsub is enabled to use IPNS pubsub')
140-
this._options.EXPERIMENTAL.pubsub = true
142+
// if (!this._options.pubsub.enabled) {
143+
if (!get(this._options, 'pubsub.enabled', false)) {
144+
this.log('pubsub is enabled to use EXPERIMENTAL IPNS pubsub')
145+
this._options.pubsub.enabled = true
141146
}
142147

143148
this.log('EXPERIMENTAL IPNS pubsub is enabled')

0 commit comments

Comments
 (0)