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

Commit e66ed1c

Browse files
committed
fix: do not let lodash mess with libp2p modules
1 parent 94191fc commit e66ed1c

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/core/components/libp2p.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = function libp2p (self) {
1919
webRTCStar: get(config, 'Discovery.webRTCStar.Enabled'),
2020
bootstrap: get(config, 'Bootstrap'),
2121
dht: get(self._options, 'EXPERIMENTAL.dht'),
22-
modules: get(self._options, 'libp2p.modules')
22+
modules: self._libp2pModules
2323
}
2424

2525
self._libp2pNode = new Node(self._peerInfo, self._peerInfoBook, options)

src/core/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class IPFS extends EventEmitter {
2727
}
2828

2929
options = options || {}
30+
this._libp2pModules = options.libp2p && options.libp2p.modules
3031

3132
extend(this._options, options)
3233

src/http-api/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@ function HttpApi (repo, config) {
3232

3333
series([
3434
(cb) => {
35-
const libp2p = {
36-
modules: {}
37-
}
35+
const libp2p = { modules: {} }
3836

3937
// Attempt to use any of the WebRTC versions available globally
4038
let electronWebRTC
4139
let wrtc
4240
try { electronWebRTC = require('electron-webrtc')() } catch (err) {}
4341
try { wrtc = require('wrtc') } catch (err) {}
4442

45-
if (electronWebRTC || wrtc) {
46-
const wstar = new WStar(electronWebRTC || wrtc)
43+
console.log(!!wrtc, !!electronWebRTC)
44+
if (wrtc || electronWebRTC) {
45+
const wstar = new WStar({ wrtc: (wrtc || electronWebRTC) })
4746
libp2p.modules.transport = [wstar]
4847
libp2p.modules.discovery = [wstar.discovery]
4948
}
@@ -59,7 +58,8 @@ function HttpApi (repo, config) {
5958
EXPERIMENTAL: {
6059
pubsub: true,
6160
sharding: config && config.enableShardingExperiment
62-
}
61+
},
62+
libp2p: libp2p
6363
})
6464
} catch (err) {
6565
return cb(err)

0 commit comments

Comments
 (0)