aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2025-03-07 09:00:10 +0800
committerGitHub <noreply@github.com>2025-03-07 01:00:10 +0000
commitef18655215d965d25050842f24f2333b89fba443 (patch)
tree7647feee00275364df8b7d325efa6626b512d39e
parente7cf62f2f722428f841539cc96f0316ae8fe5296 (diff)
downloadgitea-ef18655215d965d25050842f24f2333b89fba443.tar.gz
gitea-ef18655215d965d25050842f24f2333b89fba443.zip
Try to fix ACME (3rd) (#33807)
Fix #33802, fix #32191
-rw-r--r--cmd/web_acme.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/web_acme.go b/cmd/web_acme.go
index bca4ae0212..172dde913b 100644
--- a/cmd/web_acme.go
+++ b/cmd/web_acme.go
@@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/util"
"github.com/caddyserver/certmagic"
)
@@ -68,9 +69,15 @@ func runACME(listenAddr string, m http.Handler) error {
// And one more thing, no idea why we should set the global default variables here
// But it seems that the current ACME code needs these global variables to make renew work.
// Otherwise, "renew" will use incorrect storage path
+ oldDefaultACME := certmagic.DefaultACME
certmagic.Default.Storage = &certmagic.FileStorage{Path: setting.AcmeLiveDirectory}
certmagic.DefaultACME = certmagic.ACMEIssuer{
- CA: setting.AcmeURL,
+ // try to use the default values provided by DefaultACME
+ CA: util.IfZero(setting.AcmeURL, oldDefaultACME.CA),
+ TestCA: oldDefaultACME.TestCA,
+ Logger: oldDefaultACME.Logger,
+ HTTPProxy: oldDefaultACME.HTTPProxy,
+
TrustedRoots: certPool,
Email: setting.AcmeEmail,
Agreed: setting.AcmeTOS,