github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/web/version/version.go (about) 1 // Package version gives informations about the version of the cozy-stack 2 package version 3 4 import ( 5 "net/http" 6 "runtime" 7 8 build "github.com/cozy/cozy-stack/pkg/config" 9 "github.com/labstack/echo/v4" 10 ) 11 12 // Version responds with the git commit used at the build 13 func Version(c echo.Context) error { 14 return c.JSON(http.StatusOK, echo.Map{ 15 "version": build.Version, 16 "build_mode": build.BuildMode, 17 "build_time": build.BuildTime, 18 "runtime_version": runtime.Version(), 19 }) 20 } 21 22 // Routes sets the routing for the version service 23 func Routes(router *echo.Group) { 24 router.GET("", Version) 25 router.HEAD("", Version) 26 router.GET("/", Version) 27 router.HEAD("/", Version) 28 }