@cryptotaxi247 / kubo / commits / 2c83cd562

daemon: only try gateway addr if there

Juan Batiz-Benet committed Jan 12, 2015 at 01:05 UTC 2c83cd5627c4abd26c11938eec9590df52cabb51
1 file changed +8 -5
cmd/ipfs/daemon.go
+8 -5
@@ -111,11 +111,14 @@ func daemonFunc(req cmds.Request) (interface{}, error) {
111 return nil, err
112 }
113
114 - // ignore error for gateway address
115 - // if there is an error (invalid address), then don't run the gateway
116 - gatewayMaddr, _ := ma.NewMultiaddr(cfg.Addresses.Gateway)
117 - if gatewayMaddr == nil {
118 - fmt.Println("Invalid gateway address, not running gateway")
114 + var gatewayMaddr ma.Multiaddr
115 + if len(cfg.Addresses.Gateway) > 0 {
116 + // ignore error for gateway address
117 + // if there is an error (invalid address), then don't run the gateway
118 + gatewayMaddr, _ = ma.NewMultiaddr(cfg.Addresses.Gateway)
119 + if gatewayMaddr == nil {
120 + log.Errorf("Invalid gateway address: %s", cfg.Addresses.Gateway)
121 + }
122 }
123
124 // mount if the user provided the --mount flag