@@ -54,6 +54,10 @@ func runACME(listenAddr string, m http.Handler) error {
54
54
altTLSALPNPort = p
55
55
}
56
56
57
+ // FIXME: this path is not right, it uses "AppWorkPath" incorrectly, and writes the data into "AppWorkPath/https"
58
+ // Ideally it should migrate to AppDataPath write to "AppDataPath/https"
59
+ certmagic .Default .Storage = & certmagic.FileStorage {Path : setting .AcmeLiveDirectory }
60
+ magic := certmagic .NewDefault ()
57
61
// Try to use private CA root if provided, otherwise defaults to system's trust
58
62
var certPool * x509.CertPool
59
63
if setting .AcmeCARoot != "" {
@@ -63,13 +67,7 @@ func runACME(listenAddr string, m http.Handler) error {
63
67
log .Warn ("Failed to parse CA Root certificate, using default CA trust: %v" , err )
64
68
}
65
69
}
66
- // FIXME: this path is not right, it uses "AppWorkPath" incorrectly, and writes the data into "AppWorkPath/https"
67
- // Ideally it should migrate to AppDataPath write to "AppDataPath/https"
68
- // And one more thing, no idea why we should set the global default variables here
69
- // But it seems that the current ACME code needs these global variables to make renew work.
70
- // Otherwise, "renew" will use incorrect storage path
71
- certmagic .Default .Storage = & certmagic.FileStorage {Path : setting .AcmeLiveDirectory }
72
- certmagic .DefaultACME = certmagic.ACMEIssuer {
70
+ myACME := certmagic .NewACMEIssuer (magic , certmagic.ACMEIssuer {
73
71
CA : setting .AcmeURL ,
74
72
TrustedRoots : certPool ,
75
73
Email : setting .AcmeEmail ,
@@ -79,10 +77,8 @@ func runACME(listenAddr string, m http.Handler) error {
79
77
ListenHost : setting .HTTPAddr ,
80
78
AltTLSALPNPort : altTLSALPNPort ,
81
79
AltHTTPPort : altHTTPPort ,
82
- }
80
+ })
83
81
84
- magic := certmagic .NewDefault ()
85
- myACME := certmagic .NewACMEIssuer (magic , certmagic .DefaultACME )
86
82
magic .Issuers = []certmagic.Issuer {myACME }
87
83
88
84
// this obtains certificates or renews them if necessary
0 commit comments