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

Commit

Permalink
feat: bootstrap as an option
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jan 29, 2017
1 parent 7999b9d commit e46a643
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ Commands:
- default repo location: `~/.jsipfs` (can be changed with env variable `IPFS_PATH`)
- default swarm port: `4002`
- default API port: `5002`
- default Bootstrap is off, to enable it set `IPFS_BOOTSTRAP=1`

### HTTP-API

Expand Down
3 changes: 2 additions & 1 deletion src/cli/commands/swarm/peers.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module.exports = {
}

result.forEach((item) => {
console.log(item.addr.toString())
const addr = item.addr.toString() + item.peer.toB58String()
console.log(addr)
})
})
})
Expand Down
9 changes: 6 additions & 3 deletions src/core/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ const promisify = require('promisify-es6')
module.exports = function libp2p (self) {
return {
start: promisify((callback) => {
self.config.get('Discovery.MDNS.Enabled', gotConfig)
self.config.get(gotConfig)

function gotConfig (err, enabled) {
function gotConfig (err, config) {
if (err) {
return callback(err)
}

const options = { mdns: enabled }
const options = {
mdns: config.Discovery.MDNS.Enabled,
bootstrap: config.Bootstrap
}

self._libp2pNode = new Node(self._peerInfo, undefined, options)

Expand Down
2 changes: 2 additions & 0 deletions src/core/components/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ module.exports = function swarm (self) {
})
})

// console.log(peerList)

callback(null, peerList)
}),

Expand Down

0 comments on commit e46a643

Please sign in to comment.