Skip to content

Commit 16a3324

Browse files
authored
Try to fix ACME (3rd) (#33807) (#33808)
Backport #33807
1 parent d03e7fd commit 16a3324

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/web_acme.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"code.gitea.io/gitea/modules/log"
1717
"code.gitea.io/gitea/modules/process"
1818
"code.gitea.io/gitea/modules/setting"
19+
"code.gitea.io/gitea/modules/util"
1920

2021
"github.com/caddyserver/certmagic"
2122
)
@@ -68,9 +69,15 @@ func runACME(listenAddr string, m http.Handler) error {
6869
// And one more thing, no idea why we should set the global default variables here
6970
// But it seems that the current ACME code needs these global variables to make renew work.
7071
// Otherwise, "renew" will use incorrect storage path
72+
oldDefaultACME := certmagic.DefaultACME
7173
certmagic.Default.Storage = &certmagic.FileStorage{Path: setting.AcmeLiveDirectory}
7274
certmagic.DefaultACME = certmagic.ACMEIssuer{
73-
CA: setting.AcmeURL,
75+
// try to use the default values provided by DefaultACME
76+
CA: util.IfZero(setting.AcmeURL, oldDefaultACME.CA),
77+
TestCA: oldDefaultACME.TestCA,
78+
Logger: oldDefaultACME.Logger,
79+
HTTPProxy: oldDefaultACME.HTTPProxy,
80+
7481
TrustedRoots: certPool,
7582
Email: setting.AcmeEmail,
7683
Agreed: setting.AcmeTOS,

0 commit comments

Comments
 (0)