mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 08:23:48 +02:00
25 lines
548 B
Go
25 lines
548 B
Go
|
package server
|
||
|
|
||
|
import (
|
||
|
"github.com/drone/drone/store"
|
||
|
"github.com/drone/drone/version"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
// Health endpoint returns a 500 if the server state is unhealthy.
|
||
|
func Health(c *gin.Context) {
|
||
|
if err := store.FromContext(c).Ping(); err != nil {
|
||
|
c.String(500, err.Error())
|
||
|
return
|
||
|
}
|
||
|
c.String(200, "")
|
||
|
}
|
||
|
|
||
|
// Version endpoint returns the server version and build information.
|
||
|
func Version(c *gin.Context) {
|
||
|
c.JSON(200, gin.H{
|
||
|
"source": "https://github.com/drone/drone",
|
||
|
"version": version.Version.String(),
|
||
|
})
|
||
|
}
|