mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Fix bug
This commit is contained in:
@@ -967,12 +967,12 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
|
||||
SuccessfulTokensCacheSize = sec.Key("SUCCESSFUL_TOKENS_CACHE_SIZE").MustInt(20)
|
||||
|
||||
// Master key provider configuration
|
||||
MasterKeyProvider = sec.Key("MASTER_KEY_PROVIDER").MustString("none")
|
||||
MasterKeyProvider = sec.Key("MASTER_KEY_PROVIDER").MustString("plain")
|
||||
switch MasterKeyProvider {
|
||||
case "plain":
|
||||
if MasterKey, err = base64.StdEncoding.DecodeString(sec.Key("MASTER_KEY").MustString("")); err != nil {
|
||||
log.Fatal("error loading master key: %v", err)
|
||||
return
|
||||
MasterKey = []byte(sec.Key("MASTER_KEY").MustString(SecretKey))
|
||||
if len(MasterKey) > 32 {
|
||||
MasterKey = MasterKey[:32]
|
||||
}
|
||||
case "none":
|
||||
default:
|
||||
|
||||
@@ -46,6 +46,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/services/gitdiff"
|
||||
secret_service "code.gitea.io/gitea/services/secrets"
|
||||
|
||||
"github.com/editorconfig/editorconfig-core-go/v2"
|
||||
)
|
||||
@@ -478,6 +479,10 @@ func NewFuncMap() []template.FuncMap {
|
||||
"Shadow": func(s string) string {
|
||||
return "******"
|
||||
},
|
||||
"DecryptSecret": func(s string) string {
|
||||
v, _ := secret_service.DecryptString(s)
|
||||
return v
|
||||
},
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user