Files
jiang13-bbs/backend/handler/health.go
freefire d784b0ea7a feat: 交付官方 Docker 运行时,外观改背景图并下线自定义 CSS/JS
站点/后台分轨背景与用户列表排序一并落地;生产 CORS 改走 SITE_URL,健康检查带版本号。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-18 05:27:33 +08:00

27 lines
578 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package handler
import (
"net/http"
"github.com/freefire/jiang13-bbs/model"
"github.com/freefire/jiang13-bbs/version"
"github.com/gin-gonic/gin"
)
// Health 健康检查(官方运行时 Docker HEALTHCHECK 与反代 /health)
func (h *Handlers) Health(c *gin.Context) {
if err := model.PingDB(); err != nil {
c.JSON(http.StatusServiceUnavailable, gin.H{
"status": "error",
"error": err.Error(),
"version": version.Version,
})
return
}
c.JSON(http.StatusOK, gin.H{
"status": "ok",
"version": version.Version,
"commit": version.Commit,
})
}