diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/auth/sso/sspi_windows.go | 2 | ||||
-rw-r--r-- | modules/httpcache/httpcache.go | 2 | ||||
-rw-r--r-- | modules/setting/setting.go | 6 |
3 files changed, 7 insertions, 3 deletions
diff --git a/modules/auth/sso/sspi_windows.go b/modules/auth/sso/sspi_windows.go index 46309c27f7..448336c07b 100644 --- a/modules/auth/sso/sspi_windows.go +++ b/modules/auth/sso/sspi_windows.go @@ -56,7 +56,7 @@ func (s *SSPI) Init() error { Funcs: templates.NewFuncMap(), Asset: templates.GetAsset, AssetNames: templates.GetAssetNames, - IsDevelopment: setting.RunMode != "prod", + IsDevelopment: !setting.IsProd(), }) return nil } diff --git a/modules/httpcache/httpcache.go b/modules/httpcache/httpcache.go index c4134f8e17..cf35cef129 100644 --- a/modules/httpcache/httpcache.go +++ b/modules/httpcache/httpcache.go @@ -17,7 +17,7 @@ import ( // GetCacheControl returns a suitable "Cache-Control" header value func GetCacheControl() string { - if setting.RunMode == "dev" { + if !setting.IsProd() { return "no-store" } return "private, max-age=" + strconv.FormatInt(int64(setting.StaticCacheTime.Seconds()), 10) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 8ab4508ce5..c162c751c1 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -376,7 +376,6 @@ var ( CustomConf string PIDFile = "/run/gitea.pid" WritePIDFile bool - ProdMode bool RunMode string RunUser string IsWindows bool @@ -388,6 +387,11 @@ var ( UILocation = time.Local ) +// IsProd if it's a production mode +func IsProd() bool { + return strings.EqualFold(RunMode, "prod") +} + func getAppPath() (string, error) { var appPath string var err error |