mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-08 21:48:11 -05:00
Co-authored-by: georgehao <georgehao@users.noreply.github.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
31 lines
666 B
Go
31 lines
666 B
Go
package controller
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"gorm.io/gorm"
|
|
|
|
"bridge-history-api/internal/types"
|
|
"bridge-history-api/utils"
|
|
)
|
|
|
|
// HealthCheckController is health check API
|
|
type HealthCheckController struct {
|
|
db *gorm.DB
|
|
}
|
|
|
|
// NewHealthCheckController returns an HealthCheckController instance
|
|
func NewHealthCheckController(db *gorm.DB) *HealthCheckController {
|
|
return &HealthCheckController{
|
|
db: db,
|
|
}
|
|
}
|
|
|
|
// HealthCheck the api controller for coordinator health check
|
|
func (a *HealthCheckController) HealthCheck(c *gin.Context) {
|
|
if _, err := utils.Ping(a.db); err != nil {
|
|
types.RenderFatal(c, err)
|
|
return
|
|
}
|
|
types.RenderSuccess(c, nil)
|
|
}
|