Commit b63e10f3 authored by Matt Bell's avatar Matt Bell

core: Don't require address for node initialization

parent 7b32c113
...@@ -122,9 +122,15 @@ func initIdentity(cfg *config.Config) (*peer.Peer, error) { ...@@ -122,9 +122,15 @@ func initIdentity(cfg *config.Config) (*peer.Peer, error) {
return nil, errors.New("No peer ID in config! (was ipfs init run?)") return nil, errors.New("No peer ID in config! (was ipfs init run?)")
} }
maddr, err := ma.NewMultiaddr(cfg.Identity.Address) // address is optional
if err != nil { var addresses []*ma.Multiaddr
return nil, err if len(cfg.Identity.Address) > 0 {
maddr, err := ma.NewMultiaddr(cfg.Identity.Address)
if err != nil {
return nil, err
}
addresses = []*ma.Multiaddr{ maddr }
} }
skb, err := base64.StdEncoding.DecodeString(cfg.Identity.PrivKey) skb, err := base64.StdEncoding.DecodeString(cfg.Identity.PrivKey)
...@@ -139,7 +145,7 @@ func initIdentity(cfg *config.Config) (*peer.Peer, error) { ...@@ -139,7 +145,7 @@ func initIdentity(cfg *config.Config) (*peer.Peer, error) {
return &peer.Peer{ return &peer.Peer{
ID: peer.ID(b58.Decode(cfg.Identity.PeerID)), ID: peer.ID(b58.Decode(cfg.Identity.PeerID)),
Addresses: []*ma.Multiaddr{maddr}, Addresses: addresses,
PrivKey: sk, PrivKey: sk,
PubKey: sk.GetPublic(), PubKey: sk.GetPublic(),
}, nil }, nil
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment