mirror of
https://github.com/astaxie/beego.git
synced 2024-11-24 14:20:55 +00:00
rft: Move build info to pkg
This commit is contained in:
parent
7effdb0e7d
commit
bd1cfefec7
@ -15,12 +15,14 @@
|
|||||||
package adapter
|
package adapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/astaxie/beego/pkg"
|
||||||
"github.com/astaxie/beego/pkg/server/web"
|
"github.com/astaxie/beego/pkg/server/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
||||||
// VERSION represent beego web framework version.
|
// VERSION represent beego web framework version.
|
||||||
VERSION = web.VERSION
|
VERSION = pkg.VERSION
|
||||||
|
|
||||||
// DEV is for develop
|
// DEV is for develop
|
||||||
DEV = web.DEV
|
DEV = web.DEV
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
|
"github.com/astaxie/beego/pkg"
|
||||||
"github.com/astaxie/beego/pkg/infrastructure/logs"
|
"github.com/astaxie/beego/pkg/infrastructure/logs"
|
||||||
"github.com/astaxie/beego/pkg/server/web"
|
"github.com/astaxie/beego/pkg/server/web"
|
||||||
)
|
)
|
||||||
@ -58,13 +59,13 @@ func registerBuildInfo() {
|
|||||||
Help: "The building information",
|
Help: "The building information",
|
||||||
ConstLabels: map[string]string{
|
ConstLabels: map[string]string{
|
||||||
"appname": web.BConfig.AppName,
|
"appname": web.BConfig.AppName,
|
||||||
"build_version": web.BuildVersion,
|
"build_version": pkg.BuildVersion,
|
||||||
"build_revision": web.BuildGitRevision,
|
"build_revision": pkg.BuildGitRevision,
|
||||||
"build_status": web.BuildStatus,
|
"build_status": pkg.BuildStatus,
|
||||||
"build_tag": web.BuildTag,
|
"build_tag": pkg.BuildTag,
|
||||||
"build_time": strings.Replace(web.BuildTime, "--", " ", 1),
|
"build_time": strings.Replace(pkg.BuildTime, "--", " ", 1),
|
||||||
"go_version": web.GoVersion,
|
"go_version": pkg.GoVersion,
|
||||||
"git_branch": web.GitBranch,
|
"git_branch": pkg.GitBranch,
|
||||||
"start_time": time.Now().Format("2006-01-02 15:04:05"),
|
"start_time": time.Now().Format("2006-01-02 15:04:05"),
|
||||||
},
|
},
|
||||||
}, []string{})
|
}, []string{})
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package web
|
package pkg
|
||||||
|
|
||||||
var (
|
var (
|
||||||
BuildVersion string
|
BuildVersion string
|
||||||
@ -25,3 +25,8 @@ var (
|
|||||||
|
|
||||||
GitBranch string
|
GitBranch string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// VERSION represent beego web framework version.
|
||||||
|
VERSION = "1.12.2"
|
||||||
|
)
|
@ -22,9 +22,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// VERSION represent beego web framework version.
|
|
||||||
VERSION = "1.12.2"
|
|
||||||
|
|
||||||
// DEV is for develop
|
// DEV is for develop
|
||||||
DEV = "dev"
|
DEV = "dev"
|
||||||
// PROD is for production
|
// PROD is for production
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/astaxie/beego/pkg"
|
||||||
"github.com/astaxie/beego/pkg/infrastructure/config"
|
"github.com/astaxie/beego/pkg/infrastructure/config"
|
||||||
"github.com/astaxie/beego/pkg/infrastructure/logs"
|
"github.com/astaxie/beego/pkg/infrastructure/logs"
|
||||||
"github.com/astaxie/beego/pkg/infrastructure/session"
|
"github.com/astaxie/beego/pkg/infrastructure/session"
|
||||||
@ -208,7 +209,7 @@ func newBConfig() *Config {
|
|||||||
AppName: "beego",
|
AppName: "beego",
|
||||||
RunMode: PROD,
|
RunMode: PROD,
|
||||||
RouterCaseSensitive: true,
|
RouterCaseSensitive: true,
|
||||||
ServerName: "beegoServer:" + VERSION,
|
ServerName: "beegoServer:" + pkg.VERSION,
|
||||||
RecoverPanic: true,
|
RecoverPanic: true,
|
||||||
RecoverFunc: recoverPanic,
|
RecoverFunc: recoverPanic,
|
||||||
CopyRequestBody: false,
|
CopyRequestBody: false,
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/astaxie/beego/pkg"
|
||||||
"github.com/astaxie/beego/pkg/infrastructure/utils"
|
"github.com/astaxie/beego/pkg/infrastructure/utils"
|
||||||
|
|
||||||
"github.com/astaxie/beego/pkg/server/web/context"
|
"github.com/astaxie/beego/pkg/server/web/context"
|
||||||
@ -91,7 +92,7 @@ func showErr(err interface{}, ctx *context.Context, stack string) {
|
|||||||
"RequestURL": ctx.Input.URI(),
|
"RequestURL": ctx.Input.URI(),
|
||||||
"RemoteAddr": ctx.Input.IP(),
|
"RemoteAddr": ctx.Input.IP(),
|
||||||
"Stack": stack,
|
"Stack": stack,
|
||||||
"BeegoVersion": VERSION,
|
"BeegoVersion": pkg.VERSION,
|
||||||
"GoVersion": runtime.Version(),
|
"GoVersion": runtime.Version(),
|
||||||
}
|
}
|
||||||
t.Execute(ctx.ResponseWriter, data)
|
t.Execute(ctx.ResponseWriter, data)
|
||||||
@ -378,7 +379,7 @@ func responseError(rw http.ResponseWriter, r *http.Request, errCode int, errCont
|
|||||||
t, _ := template.New("beegoerrortemp").Parse(errtpl)
|
t, _ := template.New("beegoerrortemp").Parse(errtpl)
|
||||||
data := M{
|
data := M{
|
||||||
"Title": http.StatusText(errCode),
|
"Title": http.StatusText(errCode),
|
||||||
"BeegoVersion": VERSION,
|
"BeegoVersion": pkg.VERSION,
|
||||||
"Content": template.HTML(errContent),
|
"Content": template.HTML(errContent),
|
||||||
}
|
}
|
||||||
t.Execute(rw, data)
|
t.Execute(rw, data)
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
|
"github.com/astaxie/beego/pkg"
|
||||||
"github.com/astaxie/beego/pkg/server/web"
|
"github.com/astaxie/beego/pkg/server/web"
|
||||||
"github.com/astaxie/beego/pkg/server/web/context"
|
"github.com/astaxie/beego/pkg/server/web/context"
|
||||||
)
|
)
|
||||||
@ -63,13 +64,13 @@ func registerBuildInfo() {
|
|||||||
Help: "The building information",
|
Help: "The building information",
|
||||||
ConstLabels: map[string]string{
|
ConstLabels: map[string]string{
|
||||||
"appname": web.BConfig.AppName,
|
"appname": web.BConfig.AppName,
|
||||||
"build_version": web.BuildVersion,
|
"build_version": pkg.BuildVersion,
|
||||||
"build_revision": web.BuildGitRevision,
|
"build_revision": pkg.BuildGitRevision,
|
||||||
"build_status": web.BuildStatus,
|
"build_status": pkg.BuildStatus,
|
||||||
"build_tag": web.BuildTag,
|
"build_tag": pkg.BuildTag,
|
||||||
"build_time": strings.Replace(web.BuildTime, "--", " ", 1),
|
"build_time": strings.Replace(pkg.BuildTime, "--", " ", 1),
|
||||||
"go_version": web.GoVersion,
|
"go_version": pkg.GoVersion,
|
||||||
"git_branch": web.GitBranch,
|
"git_branch": pkg.GitBranch,
|
||||||
"start_time": time.Now().Format("2006-01-02 15:04:05"),
|
"start_time": time.Now().Format("2006-01-02 15:04:05"),
|
||||||
},
|
},
|
||||||
}, []string{})
|
}, []string{})
|
||||||
|
Loading…
Reference in New Issue
Block a user