Merge pull request #1512 from venezia/add_reflection

Add reflection to gRPC API (configurable)
This commit is contained in:
Stephan Renatus
2019-08-07 13:56:33 +02:00
committed by GitHub
8 changed files with 1561 additions and 4 deletions

View File

@@ -152,6 +152,7 @@ type GRPC struct {
TLSCert string `json:"tlsCert"`
TLSKey string `json:"tlsKey"`
TLSClientCA string `json:"tlsClientCA"`
Reflection bool `json:"reflection"`
}
// Storage holds app's storage configuration.

View File

@@ -21,6 +21,7 @@ import (
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/reflection"
"github.com/dexidp/dex/api"
"github.com/dexidp/dex/pkg/log"
@@ -283,6 +284,10 @@ func serve(cmd *cobra.Command, args []string) error {
s := grpc.NewServer(grpcOptions...)
api.RegisterDexServer(s, server.NewAPI(serverConfig.Storage, logger))
grpcMetrics.InitializeMetrics(s)
if c.GRPC.Reflection {
logger.Info("enabling reflection in grpc service")
reflection.Register(s)
}
err = s.Serve(list)
return fmt.Errorf("listening on %s failed: %v", c.GRPC.Addr, err)
}()