Skip to content

Commit

Permalink
Merge pull request #145 from filecoin-project/feat/add_status_api_v2
Browse files Browse the repository at this point in the history
feat: use thirty party healthcheck lib
  • Loading branch information
simlecode authored Feb 21, 2023
2 parents f33898b + 5fb2656 commit 343ace7
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 @@ -6,6 +6,7 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/dgraph-io/badger/v3 v3.2011.1
github.com/etherlabsio/healthcheck/v2 v2.0.0
github.com/filecoin-project/go-address v0.0.5
github.com/filecoin-project/go-jsonrpc v0.1.3
github.com/fsnotify/fsnotify v1.4.9
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 343ace7

Please sign in to comment.