api/v3/server: Fix binding in ipv4 only systems

This workarounds 0.0.0.0 not working in ipv4 only systems.

Fixes #526 #533
This commit is contained in:
Heitham Omar 2018-04-14 20:53:00 +01:00
parent a5b3e747a0
commit d694517d90

View File

@ -124,6 +124,9 @@ func newGrpcGatewayServer(ctx context.Context, listenerAddr string, tlsConfig *t
jsonOpt := runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{EmitDefaults: true})
gwmux := runtime.NewServeMux(jsonOpt)
// workaround for https://github.com/golang/go/issues/18806
listenerAddr = strings.TrimPrefix(listenerAddr, "[::]")
conn, err := grpc.DialContext(ctx, listenerAddr, gwOpts...)
if err != nil {
log.WithError(err).Fatal("could not initialize grpc gateway connection")