Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Version api #92

Merged
merged 2 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL=/usr/bin/env bash
git=$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))


ldflags=-X=github.com/filecoin-project/venus-auth/core.CurrentCommit='+$(git)'
ldflags=-X=github.com/filecoin-project/venus-auth/core.CurrentCommit=+git.$(git)
ifneq ($(strip $(LDFLAGS)),)
ldflags+=-extldflags=$(LDFLAGS)
endif
Expand All @@ -21,7 +21,6 @@ venus-auth:show-env $(BUILD_DEPS)
go build $(GOFLAGS) -o venus-auth ./cmd/server/*.go

lint:
gofmt -s -w ./
golangci-lint run

linux: clean
Expand Down
8 changes: 8 additions & 0 deletions auth/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ import (
func InitRouter(app OAuthApp) http.Handler {
router := gin.New()
router.Use(CorsMiddleWare())

router.GET("/version", func(c *gin.Context) {
type version struct {
Version string
}
c.JSON(http.StatusOK, version{Version: core.Version})
})

router.POST("/verify", verifyInterceptor(), app.Verify)
router.POST("/genToken", app.GenerateToken)
router.GET("/token", app.GetToken)
Expand Down