diff options
author | Chris <ccbrown112@gmail.com> | 2017-10-26 14:21:22 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-10-26 15:21:22 -0400 |
commit | 7ed011745a544873f40f806f1803cb8a4998ba01 (patch) | |
tree | fe13919b050b33c8dd3f6ca5fce6ad1980b2dd3e /web/web.go | |
parent | a0bfd2885d03e3f9fb6b3cdd6ba60eea93c848b2 (diff) | |
download | chat-7ed011745a544873f40f806f1803cb8a4998ba01.tar.gz chat-7ed011745a544873f40f806f1803cb8a4998ba01.tar.bz2 chat-7ed011745a544873f40f806f1803cb8a4998ba01.zip |
Remove more global refs / state (#7723)
* remove more global refs / state
* fix job enterprise initialization
* fix api4 test compilation
* saml api endpoints fix
Diffstat (limited to 'web/web.go')
-rw-r--r-- | web/web.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/web/web.go b/web/web.go index 77a0c107a..1724fd3f2 100644 --- a/web/web.go +++ b/web/web.go @@ -21,14 +21,14 @@ func Init(api3 *api.API) { mainrouter := api3.BaseRoutes.Root - if *utils.Cfg.ServiceSettings.WebserverMode != "disabled" { + if *api3.App.Config().ServiceSettings.WebserverMode != "disabled" { staticDir, _ := utils.FindDir(model.CLIENT_DIR) l4g.Debug("Using client directory at %v", staticDir) staticHandler := staticHandler(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir)))) - pluginHandler := pluginHandler(http.StripPrefix("/static/plugins/", http.FileServer(http.Dir(staticDir+"plugins/")))) + pluginHandler := pluginHandler(api3.App.Config, http.StripPrefix("/static/plugins/", http.FileServer(http.Dir(staticDir+"plugins/")))) - if *utils.Cfg.ServiceSettings.WebserverMode == "gzip" { + if *api3.App.Config().ServiceSettings.WebserverMode == "gzip" { staticHandler = gziphandler.GzipHandler(staticHandler) pluginHandler = gziphandler.GzipHandler(pluginHandler) } @@ -50,9 +50,9 @@ func staticHandler(handler http.Handler) http.Handler { }) } -func pluginHandler(handler http.Handler) http.Handler { +func pluginHandler(config model.ConfigFunc, handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if *utils.Cfg.ServiceSettings.EnableDeveloper { + if *config().ServiceSettings.EnableDeveloper { w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") } else { w.Header().Set("Cache-Control", "max-age=31556926, public") |