Merge pull request #1512 from venezia/add_reflection
Add reflection to gRPC API (configurable)
This commit is contained in:
@@ -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.
|
||||
|
@@ -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)
|
||||
}()
|
||||
|
Reference in New Issue
Block a user