Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-28 04:36:11 +01:00

Avoid writing config file if not installed (#26107) (#26113)

Backport #26107 by @wxiaoguang

Just like others (oauth2 secret, internal token, etc), do not generate
if no install lock

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit e2596b0a99)
This commit is contained in:
Giteabot 2023-07-25 01:31:50 -04:00 committed by Earl Warren
parent 4be3270e87
commit 78722734fe
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -63,7 +63,7 @@ func loadLFSFrom(rootCfg ConfigProvider) error {
LFS.JWTSecretBytes = make([]byte, 32) LFS.JWTSecretBytes = make([]byte, 32)
n, err := base64.RawURLEncoding.Decode(LFS.JWTSecretBytes, []byte(LFS.JWTSecretBase64)) n, err := base64.RawURLEncoding.Decode(LFS.JWTSecretBytes, []byte(LFS.JWTSecretBase64))
if err != nil || n != 32 { if (err != nil || n != 32) && InstallLock {
LFS.JWTSecretBase64, err = generate.NewJwtSecretBase64() LFS.JWTSecretBase64, err = generate.NewJwtSecretBase64()
if err != nil { if err != nil {
return fmt.Errorf("error generating JWT Secret for custom config: %v", err) return fmt.Errorf("error generating JWT Secret for custom config: %v", err)