Added Gzip option and the macaron Gzip middleware, but does not seem to work
This commit is contained in:
@@ -9,6 +9,7 @@ http_addr =
|
|||||||
http_port = 3000
|
http_port = 3000
|
||||||
router_logging = false
|
router_logging = false
|
||||||
static_root_path = public
|
static_root_path = public
|
||||||
|
enable_gzip = false
|
||||||
|
|
||||||
[session]
|
[session]
|
||||||
; Either "memory", "file", default is "memory"
|
; Either "memory", "file", default is "memory"
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ func newMacaron() *macaron.Macaron {
|
|||||||
m := macaron.New()
|
m := macaron.New()
|
||||||
m.Use(middleware.Logger())
|
m.Use(middleware.Logger())
|
||||||
m.Use(macaron.Recovery())
|
m.Use(macaron.Recovery())
|
||||||
|
if setting.EnableGzip {
|
||||||
|
m.Use(macaron.Gziper())
|
||||||
|
}
|
||||||
|
|
||||||
mapStatic(m, "", "public")
|
mapStatic(m, "", "public")
|
||||||
mapStatic(m, "app", "app")
|
mapStatic(m, "app", "app")
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ var (
|
|||||||
CertFile, KeyFile string
|
CertFile, KeyFile string
|
||||||
RouterLogging bool
|
RouterLogging bool
|
||||||
StaticRootPath string
|
StaticRootPath string
|
||||||
|
EnableGzip bool
|
||||||
|
|
||||||
// Http auth
|
// Http auth
|
||||||
Anonymous bool
|
Anonymous bool
|
||||||
@@ -164,6 +165,7 @@ func NewConfigContext() {
|
|||||||
|
|
||||||
StaticRootPath = Cfg.MustValue("server", "static_root_path", path.Join(WorkDir, "webapp"))
|
StaticRootPath = Cfg.MustValue("server", "static_root_path", path.Join(WorkDir, "webapp"))
|
||||||
RouterLogging = Cfg.MustBool("server", "router_logging", false)
|
RouterLogging = Cfg.MustBool("server", "router_logging", false)
|
||||||
|
EnableGzip = Cfg.MustBool("server", "enable_gzip")
|
||||||
|
|
||||||
// Http auth
|
// Http auth
|
||||||
Anonymous = Cfg.MustBool("auth", "anonymous", false)
|
Anonymous = Cfg.MustBool("auth", "anonymous", false)
|
||||||
|
|||||||
Reference in New Issue
Block a user