1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 09:59:13 +08:00

daemon: only try gateway addr if there

This commit is contained in:
Juan Batiz-Benet
2015-01-12 01:05:15 -08:00
parent f215eee3ed
commit 2c83cd5627

View File

@ -111,11 +111,14 @@ func daemonFunc(req cmds.Request) (interface{}, error) {
return nil, err return nil, err
} }
// ignore error for gateway address var gatewayMaddr ma.Multiaddr
// if there is an error (invalid address), then don't run the gateway if len(cfg.Addresses.Gateway) > 0 {
gatewayMaddr, _ := ma.NewMultiaddr(cfg.Addresses.Gateway) // ignore error for gateway address
if gatewayMaddr == nil { // if there is an error (invalid address), then don't run the gateway
fmt.Println("Invalid gateway address, not running gateway") gatewayMaddr, _ = ma.NewMultiaddr(cfg.Addresses.Gateway)
if gatewayMaddr == nil {
log.Errorf("Invalid gateway address: %s", cfg.Addresses.Gateway)
}
} }
// mount if the user provided the --mount flag // mount if the user provided the --mount flag