loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Avoid polluting the config (#25345)

Caught by #25330

Co-authored-by: Giteabot <teabot@gitea.io>

authored by

wxiaoguang
Giteabot
and committed by
GitHub
a5d0246f 695f5d17

+15 -13
+1 -1
modules/setting/mirror.go
··· 30 30 // DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version 31 31 // if these are removed, the warning will not be shown 32 32 deprecatedSetting(rootCfg, "repository", "DISABLE_MIRRORS", "mirror", "ENABLED", "v1.19.0") 33 - if rootCfg.Section("repository").Key("DISABLE_MIRRORS").MustBool(false) { 33 + if ConfigSectionKeyBool(rootCfg.Section("repository"), "DISABLE_MIRRORS") { 34 34 Mirror.DisableNewPull = true 35 35 } 36 36
+13 -11
modules/setting/oauth2.go
··· 120 120 OAuth2.JWTSigningPrivateKeyFile = filepath.Join(AppDataPath, OAuth2.JWTSigningPrivateKeyFile) 121 121 } 122 122 123 - key := make([]byte, 32) 124 - n, err := base64.RawURLEncoding.Decode(key, []byte(OAuth2.JWTSecretBase64)) 125 - if err != nil || n != 32 { 126 - key, err = generate.NewJwtSecret() 127 - if err != nil { 128 - log.Fatal("error generating JWT secret: %v", err) 129 - } 123 + if InstallLock { 124 + key := make([]byte, 32) 125 + n, err := base64.RawURLEncoding.Decode(key, []byte(OAuth2.JWTSecretBase64)) 126 + if err != nil || n != 32 { 127 + key, err = generate.NewJwtSecret() 128 + if err != nil { 129 + log.Fatal("error generating JWT secret: %v", err) 130 + } 130 131 131 - secretBase64 := base64.RawURLEncoding.EncodeToString(key) 132 - rootCfg.Section("oauth2").Key("JWT_SECRET").SetValue(secretBase64) 133 - if err := rootCfg.Save(); err != nil { 134 - log.Fatal("save oauth2.JWT_SECRET failed: %v", err) 132 + secretBase64 := base64.RawURLEncoding.EncodeToString(key) 133 + rootCfg.Section("oauth2").Key("JWT_SECRET").SetValue(secretBase64) 134 + if err := rootCfg.Save(); err != nil { 135 + log.Fatal("save oauth2.JWT_SECRET failed: %v", err) 136 + } 135 137 } 136 138 } 137 139 }
+1 -1
modules/setting/setting.go
··· 262 262 RunUser = rootSec.Key("RUN_USER").MustString(user.CurrentUsername()) 263 263 // The following is a purposefully undocumented option. Please do not run Gitea as root. It will only cause future headaches. 264 264 // Please don't use root as a bandaid to "fix" something that is broken, instead the broken thing should instead be fixed properly. 265 - unsafeAllowRunAsRoot := rootSec.Key("I_AM_BEING_UNSAFE_RUNNING_AS_ROOT").MustBool(false) 265 + unsafeAllowRunAsRoot := ConfigSectionKeyBool(rootSec, "I_AM_BEING_UNSAFE_RUNNING_AS_ROOT") 266 266 RunMode = os.Getenv("GITEA_RUN_MODE") 267 267 if RunMode == "" { 268 268 RunMode = rootSec.Key("RUN_MODE").MustString("prod")