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

Commit

Permalink
fix: do not let lodash mess with libp2p modules
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jun 29, 2017
1 parent 94191fc commit 1f68b9b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/core/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function libp2p (self) {
webRTCStar: get(config, 'Discovery.webRTCStar.Enabled'),
bootstrap: get(config, 'Bootstrap'),
dht: get(self._options, 'EXPERIMENTAL.dht'),
modules: get(self._options, 'libp2p.modules')
modules: self._libp2pModules
}

self._libp2pNode = new Node(self._peerInfo, self._peerInfoBook, options)
Expand Down
1 change: 1 addition & 0 deletions src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class IPFS extends EventEmitter {
}

options = options || {}
this._libp2pModules = options.libp2p && options.libp2p.modules

extend(this._options, options)

Expand Down
11 changes: 5 additions & 6 deletions src/http-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ function HttpApi (repo, config) {

series([
(cb) => {
const libp2p = {
modules: {}
}
const libp2p = { modules: {} }

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

if (electronWebRTC || wrtc) {
const wstar = new WStar(electronWebRTC || wrtc)
if (wrtc || electronWebRTC) {
const wstar = new WStar({ wrtc: (wrtc || electronWebRTC) })
libp2p.modules.transport = [wstar]
libp2p.modules.discovery = [wstar.discovery]
}
Expand All @@ -59,7 +57,8 @@ function HttpApi (repo, config) {
EXPERIMENTAL: {
pubsub: true,
sharding: config && config.enableShardingExperiment
}
},
libp2p: libp2p
})
} catch (err) {
return cb(err)
Expand Down

0 comments on commit 1f68b9b

Please sign in to comment.