From 166ce7d2aec26ed3cc900f954baa8959ed91d2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 14 Jan 2015 10:34:14 +0100 Subject: [PATCH] Added Gzip option and the macaron Gzip middleware, but does not seem to work --- conf/grafana.ini | 1 + pkg/cmd/web.go | 3 +++ pkg/setting/setting.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/conf/grafana.ini b/conf/grafana.ini index a39009b9ad3..f0210e89b36 100644 --- a/conf/grafana.ini +++ b/conf/grafana.ini @@ -9,6 +9,7 @@ http_addr = http_port = 3000 router_logging = false static_root_path = public +enable_gzip = false [session] ; Either "memory", "file", default is "memory" diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 3ba64fb136c..786c5304534 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -39,6 +39,9 @@ func newMacaron() *macaron.Macaron { m := macaron.New() m.Use(middleware.Logger()) m.Use(macaron.Recovery()) + if setting.EnableGzip { + m.Use(macaron.Gziper()) + } mapStatic(m, "", "public") mapStatic(m, "app", "app") diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 51bfb58acd6..4805949eb33 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -56,6 +56,7 @@ var ( CertFile, KeyFile string RouterLogging bool StaticRootPath string + EnableGzip bool // Http auth Anonymous bool @@ -164,6 +165,7 @@ func NewConfigContext() { StaticRootPath = Cfg.MustValue("server", "static_root_path", path.Join(WorkDir, "webapp")) RouterLogging = Cfg.MustBool("server", "router_logging", false) + EnableGzip = Cfg.MustBool("server", "enable_gzip") // Http auth Anonymous = Cfg.MustBool("auth", "anonymous", false)