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 }