move version to package

This commit is contained in:
Brad Rydzewski
2016-03-30 00:48:47 -07:00
parent 8a6857a74b
commit f9bba48e19
4 changed files with 25 additions and 14 deletions

View File

@@ -4,11 +4,10 @@ import (
"net/http"
"time"
"github.com/drone/drone/version"
"github.com/gin-gonic/gin"
)
var version string
// NoCache is a middleware function that appends headers
// to prevent the client from caching the HTTP response.
func NoCache(c *gin.Context) {
@@ -52,10 +51,7 @@ func Secure(c *gin.Context) {
// Version is a middleware function that appends the Drone
// version information to the HTTP response. This is intended
// for debugging and troubleshooting.
func Version(version string) gin.HandlerFunc {
return func(c *gin.Context) {
c.Set("version", "0.4.0-beta+"+version)
c.Header("X-DRONE-VERSION", "0.4.0-beta+"+version)
c.Next()
}
func Version(c *gin.Context) {
c.Header("X-DRONE-VERSION", version.Version)
c.Next()
}