27 lines
591 B
Go
27 lines
591 B
Go
package grpcadapter
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gl/application/health"
|
|
basev1 "gl/gen/base/v1"
|
|
ledgerv1 "gl/gen/ledger/v1"
|
|
)
|
|
|
|
type HealthHandler struct {
|
|
ledgerv1.UnimplementedGeneralLedgerServiceServer
|
|
service *health.Service
|
|
}
|
|
|
|
func NewHealthHandler(service *health.Service) *HealthHandler {
|
|
return &HealthHandler{service: service}
|
|
}
|
|
|
|
func (h *HealthHandler) Health(ctx context.Context, _ *basev1.Empty) (*ledgerv1.HealthResponse, error) {
|
|
result := h.service.Check(ctx)
|
|
return &ledgerv1.HealthResponse{
|
|
Serving: result.Serving,
|
|
DatabaseReady: result.DatabaseReady,
|
|
}, nil
|
|
}
|