Skip to content

Commit c084de2

Browse files
committed
fix test
1 parent 57a0704 commit c084de2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/setting/security.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,12 @@ func loadSecurityFrom(rootCfg ConfigProvider) {
198198

199199
func GetGeneralTokenSigningSecret() []byte {
200200
if len(GeneralWebSecretBytes) == 0 {
201-
log.Fatal("GeneralWebSecretBytes is empty")
201+
// FIXME: it shouldn't happen in production. At the monment only some tests are using the secret without initializing it.
202+
LogStartupProblem(1, log.WARN, "OAuth2 is not enabled, unable to use a persistent signing secret, a new one is generated, which is not persistent between restarts and cluster nodes")
203+
GeneralWebSecretBytes, _, _ = generate.NewGeneralWebSecretWithBase64()
204+
if len(GeneralWebSecretBytes) == 0 {
205+
panic("Failed to generate a new GeneralWebSecretBytes") // impossible to happen
206+
}
202207
}
203208
return GeneralWebSecretBytes
204209
}

0 commit comments

Comments
 (0)