grpc: make sure typed errors handler is installed
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
bac9062496
commit
7c731e02a9
|
@ -2,6 +2,7 @@ package grpc // import "github.com/docker/docker/api/server/router/grpc"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/docker/docker/api/server/router"
|
"github.com/docker/docker/api/server/router"
|
||||||
|
"github.com/moby/buildkit/util/grpcerrors"
|
||||||
"golang.org/x/net/http2"
|
"golang.org/x/net/http2"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
@ -14,9 +15,12 @@ type grpcRouter struct {
|
||||||
|
|
||||||
// NewRouter initializes a new grpc http router
|
// NewRouter initializes a new grpc http router
|
||||||
func NewRouter(backends ...Backend) router.Router {
|
func NewRouter(backends ...Backend) router.Router {
|
||||||
|
opts := []grpc.ServerOption{grpc.UnaryInterceptor(grpcerrors.UnaryServerInterceptor), grpc.StreamInterceptor(grpcerrors.StreamServerInterceptor)}
|
||||||
|
server := grpc.NewServer(opts...)
|
||||||
|
|
||||||
r := &grpcRouter{
|
r := &grpcRouter{
|
||||||
h2Server: &http2.Server{},
|
h2Server: &http2.Server{},
|
||||||
grpcServer: grpc.NewServer(),
|
grpcServer: server,
|
||||||
}
|
}
|
||||||
for _, b := range backends {
|
for _, b := range backends {
|
||||||
b.RegisterGRPC(r.grpcServer)
|
b.RegisterGRPC(r.grpcServer)
|
||||||
|
|
Loading…
Reference in New Issue