diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-06-29 12:30:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-29 06:30:40 +0200 |
commit | e6f62eea7020c0c4ec60aab31a56b76870d4cd21 (patch) | |
tree | ce787013c35082a7eebda6ab02a6959a867ed1b7 /modules/setting | |
parent | 8981f6d0fc375c75ff5a2c1b6eb9e33c8dbaf722 (diff) | |
download | gitea-e6f62eea7020c0c4ec60aab31a56b76870d4cd21.tar.gz gitea-e6f62eea7020c0c4ec60aab31a56b76870d4cd21.zip |
Do not prepare oauth2 config if it is not enabled, do not write config in some sub-commands (#25567) (#25576)
Backport #25567
Ref:
* https://github.com/go-gitea/gitea/issues/25377#issuecomment-1609757289
And some sub-commands like "generate" / "docs", they do not need to use
the ini config
Diffstat (limited to 'modules/setting')
-rw-r--r-- | modules/setting/oauth2.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/setting/oauth2.go b/modules/setting/oauth2.go index 83c607a416..883348586b 100644 --- a/modules/setting/oauth2.go +++ b/modules/setting/oauth2.go @@ -116,6 +116,10 @@ func loadOAuth2From(rootCfg ConfigProvider) { return } + if !OAuth2.Enable { + return + } + if !filepath.IsAbs(OAuth2.JWTSigningPrivateKeyFile) { OAuth2.JWTSigningPrivateKeyFile = filepath.Join(AppDataPath, OAuth2.JWTSigningPrivateKeyFile) } |