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

Commit b1e8d36

Browse files
committed
feat: pre-start throws if Adresses.Swarm is missing
1 parent 187869c commit b1e8d36

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/core/components/pre-start.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ module.exports = function preStart (self) {
2222
(config, id, cb) => {
2323
self._peerInfo = new PeerInfo(id)
2424

25-
config.Addresses.Swarm.forEach((addr) => {
26-
let ma = multiaddr(addr)
25+
if (config.Addresses && config.Addresses.Swarm) {
26+
config.Addresses.Swarm.forEach((addr) => {
27+
let ma = multiaddr(addr)
2728

28-
if (ma.getPeerId()) {
29-
ma = ma.encapsulate('/ipfs/' + self._peerInfo.id.toB58String())
30-
}
29+
if (ma.getPeerId()) {
30+
ma = ma.encapsulate('/ipfs/' + self._peerInfo.id.toB58String())
31+
}
3132

32-
self._peerInfo.multiaddrs.add(ma)
33-
})
33+
self._peerInfo.multiaddrs.add(ma)
34+
})
35+
}
3436

3537
cb()
3638
}

0 commit comments

Comments
 (0)