Use IsProd instead of testing if it's equal. (#14336)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
60a3297a33
commit
84b147c7f0
7 changed files with 17 additions and 14 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue