mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:30:54 +00:00
init gzip level
This commit is contained in:
parent
48147f50d8
commit
5a9bff2000
8
beego.go
8
beego.go
@ -22,12 +22,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// VERSION represent beego web framework version.
|
// VERSION represent beego web framework version.
|
||||||
VERSION = "1.6.1"
|
VERSION = "1.6.1"
|
||||||
|
|
||||||
// DEV is for develop
|
// DEV is for develop
|
||||||
DEV = "dev"
|
DEV = "dev"
|
||||||
// PROD is for production
|
// PROD is for production
|
||||||
PROD = "prod"
|
PROD = "prod"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ func AddAPPStartHook(hf hookfunc) {
|
|||||||
// beego.Run(":8089")
|
// beego.Run(":8089")
|
||||||
// beego.Run("127.0.0.1:8089")
|
// beego.Run("127.0.0.1:8089")
|
||||||
func Run(params ...string) {
|
func Run(params ...string) {
|
||||||
|
|
||||||
initBeforeHTTPRun()
|
initBeforeHTTPRun()
|
||||||
|
|
||||||
if len(params) > 0 && params[0] != "" {
|
if len(params) > 0 && params[0] != "" {
|
||||||
@ -74,6 +75,7 @@ func initBeforeHTTPRun() {
|
|||||||
AddAPPStartHook(registerDocs)
|
AddAPPStartHook(registerDocs)
|
||||||
AddAPPStartHook(registerTemplate)
|
AddAPPStartHook(registerTemplate)
|
||||||
AddAPPStartHook(registerAdmin)
|
AddAPPStartHook(registerAdmin)
|
||||||
|
AddAPPStartHook(registerGzip)
|
||||||
|
|
||||||
for _, hk := range hooks {
|
for _, hk := range hooks {
|
||||||
if err := hk(); err != nil {
|
if err := hk(); err != nil {
|
||||||
|
8
hooks.go
8
hooks.go
@ -6,6 +6,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/astaxie/beego/context"
|
||||||
"github.com/astaxie/beego/session"
|
"github.com/astaxie/beego/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -91,3 +92,10 @@ func registerAdmin() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func registerGzip() error {
|
||||||
|
if BConfig.EnableGzip {
|
||||||
|
context.InitGzip(AppConfig)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user