1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 01:52:26 +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
}
// ignore error for gateway address
// if there is an error (invalid address), then don't run the gateway
gatewayMaddr, _ := ma.NewMultiaddr(cfg.Addresses.Gateway)
if gatewayMaddr == nil {
fmt.Println("Invalid gateway address, not running gateway")
var gatewayMaddr ma.Multiaddr
if len(cfg.Addresses.Gateway) > 0 {
// ignore error for gateway address
// if there is an error (invalid address), then don't run the 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