Skip to content

Commit

Permalink
cloudapi: introduce version endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap committed Dec 4, 2024
1 parent f4a4776 commit c1f0d26
Show file tree
Hide file tree
Showing 5 changed files with 279 additions and 183 deletions.
13 changes: 13 additions & 0 deletions internal/cloudapi/v2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ func (b binder) Bind(i interface{}, ctx echo.Context) error {
return nil
}

func (h *apiHandlers) GetVersion(ctx echo.Context) error {
spec, err := GetSwagger()
if err != nil {
return HTTPError(ErrorFailedToLoadOpenAPISpec)
}
version := Version{
Version: spec.Info.Version,
BuildCommit: common.ToPtr(common.BuildCommit),
BuildTime: common.ToPtr(common.BuildTime),
}
return ctx.JSON(http.StatusOK, version)
}

func (h *apiHandlers) GetOpenapi(ctx echo.Context) error {
spec, err := GetSwagger()
if err != nil {
Expand Down
Loading

0 comments on commit c1f0d26

Please sign in to comment.