Skip to content

Commit

Permalink
feat: use thirty party healthcheck lib
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Feb 21, 2023
1 parent 9e27317 commit 210b4ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions auth/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"net/url"
"time"

"github.com/etherlabsio/healthcheck/v2"

"github.com/filecoin-project/venus-auth/core"
"github.com/filecoin-project/venus-auth/log"
"github.com/gin-gonic/gin"
Expand All @@ -17,9 +19,11 @@ func InitRouter(app OAuthApp) http.Handler {
router.Use(CorsMiddleWare())
router.Use(RewriteAddressInUrl())

router.GET("/status", func(c *gin.Context) {
c.String(http.StatusOK, "OK")
headlerFunc := healthcheck.HandlerFunc()
router.GET("/healthcheck", func(c *gin.Context) {
headlerFunc(c.Writer, c.Request)
})

router.GET("/version", func(c *gin.Context) {
type version struct {
Version string
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ require (
github.com/deepmap/oapi-codegen v1.3.13 // indirect
github.com/dgraph-io/ristretto v0.0.4-0.20210122082011-bb5d392ed82d // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/etherlabsio/healthcheck/v2 v2.0.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/etherlabsio/healthcheck/v2 v2.0.0 h1:oKq8cbpwM/yNGPXf2Sff6MIjVUjx/pGYFydWzeK2MpA=
github.com/etherlabsio/healthcheck/v2 v2.0.0/go.mod h1:huNVOjKzu6FI1eaO1CGD3ZjhrmPWf5Obu/pzpI6/wog=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/filecoin-project/go-address v0.0.5 h1:SSaFT/5aLfPXycUlFyemoHYhRgdyXClXCyDdNJKPlDM=
github.com/filecoin-project/go-address v0.0.5/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
Expand Down

0 comments on commit 210b4ea

Please sign in to comment.