Commit: Bulk unfinished work
This commit is contained in:
26
utils/healthcheck.go
Normal file
26
utils/healthcheck.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package utils
|
||||
|
||||
// Keep (used in cmd/api/main.go)
|
||||
|
||||
// Healthcheck utilities for gRPC services
|
||||
// using connect-go and grpchealth
|
||||
import (
|
||||
"connectrpc.com/grpchealth"
|
||||
"git.kocoder.xyz/kocoded/vt/fx"
|
||||
"git.kocoder.xyz/kocoded/vt/gen/project/v1/projectv1connect"
|
||||
"git.kocoder.xyz/kocoded/vt/gen/todo/v1/todov1connect"
|
||||
)
|
||||
|
||||
func NewHealthchecker() grpchealth.Checker {
|
||||
checker := grpchealth.NewStaticChecker()
|
||||
|
||||
checker.SetStatus(projectv1connect.ProjectServiceName, grpchealth.StatusServing)
|
||||
checker.SetStatus(todov1connect.TodoServiceName, grpchealth.StatusServing)
|
||||
|
||||
return checker
|
||||
}
|
||||
|
||||
func NewHealthCheckV1(healthChecker grpchealth.Checker) fx.Handler {
|
||||
path, handler := grpchealth.NewHandler(healthChecker)
|
||||
return fx.NewRoute(path, handler)
|
||||
}
|
||||
Reference in New Issue
Block a user