From b1d548b9f048088c54be10040017e2b32ed2d243 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Mon, 1 Jul 2024 12:35:02 -0400 Subject: [PATCH] Don't init oauth if settings have it disabled --- services/auth/source/oauth2/init.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/auth/source/oauth2/init.go b/services/auth/source/oauth2/init.go index 5c25681548..2e3df14609 100644 --- a/services/auth/source/oauth2/init.go +++ b/services/auth/source/oauth2/init.go @@ -30,6 +30,11 @@ const ProviderHeaderKey = "gitea-oauth2-provider" // Init initializes the oauth source func Init(ctx context.Context) error { + // if oauth is disabled, we don't need to initialize anything + if !setting.OAuth2.Enable { + return + } + if err := InitSigningKey(); err != nil { return err }