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>
36 lines
744 B
Go
36 lines
744 B
Go
package observability
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"gorm.io/gorm"
|
|
|
|
"scroll-tech/common/database"
|
|
"scroll-tech/common/types"
|
|
)
|
|
|
|
// ProbesController probe check controller
|
|
type ProbesController struct {
|
|
db *gorm.DB
|
|
}
|
|
|
|
// NewProbesController returns an ProbesController instance
|
|
func NewProbesController(db *gorm.DB) *ProbesController {
|
|
return &ProbesController{
|
|
db: db,
|
|
}
|
|
}
|
|
|
|
// HealthCheck the api controller for health check
|
|
func (a *ProbesController) HealthCheck(c *gin.Context) {
|
|
if _, err := database.Ping(a.db); err != nil {
|
|
types.RenderFatal(c, err)
|
|
return
|
|
}
|
|
types.RenderSuccess(c, nil)
|
|
}
|
|
|
|
// Ready the api controller for ready check
|
|
func (a *ProbesController) Ready(c *gin.Context) {
|
|
types.RenderSuccess(c, nil)
|
|
}
|