Make the debug handler an actual thing that can be set by users

This commit is contained in:
Asim
2016-01-06 19:24:54 +00:00
parent 66107fd304
commit 76918fc703
9 changed files with 137 additions and 91 deletions

21
server/debug.go Normal file
View File

@@ -0,0 +1,21 @@
package server
import (
"github.com/micro/go-micro/server/debug"
proto "github.com/micro/go-micro/server/debug/proto"
"golang.org/x/net/context"
)
// We use this to wrap any debug handlers so we preserve the signature Debug.{Method}
type Debug struct {
debug.DebugHandler
}
func (d *Debug) Health(ctx context.Context, req *proto.HealthRequest, rsp *proto.HealthResponse) error {
return d.DebugHandler.Health(ctx, req, rsp)
}
func registerDebugHandler(s Server) {
s.Handle(s.NewHandler(&Debug{s.Options().DebugHandler}))
}