-
Notifications
You must be signed in to change notification settings - Fork 1
/
service.go
31 lines (24 loc) · 900 Bytes
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package health
import (
"context"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
)
type healthService struct {
UnimplementedHealthServer
}
// RegisterInternalGRPCGatewayHandler grpc-gateway health handler
func RegisterInternalGRPCGatewayHandler(mux *runtime.ServeMux, endpoint string) error {
return RegisterHealthHandlerFromEndpoint(context.Background(), mux, endpoint, []grpc.DialOption{grpc.WithInsecure()})
}
// RegisterInternalHealthService grpc server health api registration
func RegisterInternalHealthService(srv *grpc.Server) {
RegisterHealthServer(srv, ImplementedHealthService())
}
// ImplementedHealthService internal health service
func ImplementedHealthService() HealthServer {
return &healthService{}
}
func (*healthService) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
return new(HealthCheckResponse), nil
}