Skip to content

Commit c0fc53e

Browse files
Import additional secrets via file uri (#25408)
1 parent 478f330 commit c0fc53e

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

modules/setting/lfs.go

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func loadLFSFrom(rootCfg ConfigProvider) error {
5353
return nil
5454
}
5555

56+
LFS.JWTSecretBase64 = loadSecret(rootCfg.Section("lfs"), "LFS_JWT_SECRET_URI", "LFS_JWT_SECRET")
57+
5658
LFS.JWTSecretBytes = make([]byte, 32)
5759
n, err := base64.RawURLEncoding.Decode(LFS.JWTSecretBytes, []byte(LFS.JWTSecretBase64))
5860

modules/setting/oauth2.go

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ func loadOAuth2From(rootCfg ConfigProvider) {
116116
return
117117
}
118118

119+
OAuth2.JWTSecretBase64 = loadSecret(rootCfg.Section("oauth2"), "JWT_SECRET_URI", "JWT_SECRET")
120+
119121
if !filepath.IsAbs(OAuth2.JWTSigningPrivateKeyFile) {
120122
OAuth2.JWTSigningPrivateKeyFile = filepath.Join(AppDataPath, OAuth2.JWTSigningPrivateKeyFile)
121123
}

modules/setting/security.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func loadSecret(sec ConfigSection, uriKey, verbatimKey string) string {
7676

7777
// only file URIs are allowed
7878
default:
79-
log.Fatal("Unsupported URI-Scheme %q (INTERNAL_TOKEN_URI = %q)", tempURI.Scheme, uri)
79+
log.Fatal("Unsupported URI-Scheme %q (%q = %q)", tempURI.Scheme, uriKey, uri)
8080
return ""
8181
}
8282
}

0 commit comments

Comments
 (0)