Make it possible to disable rate limits

This commit is contained in:
Moritz Marquardt 2021-11-20 21:12:28 +01:00
parent c99dbb34ce
commit f22cd6c4e0
No known key found for this signature in database
GPG key ID: D5788327BEE388B6
2 changed files with 8 additions and 3 deletions

View file

@ -278,12 +278,16 @@ func obtainCert(acmeClient *lego.Client, domains []string, renew *certificate.Re
var res *certificate.Resource
var err error
if renew != nil {
acmeClientRequestLimit.Take()
if os.Getenv("ACME_USE_RATE_LIMITS") != "false" {
acmeClientRequestLimit.Take()
}
log.Printf("Renewing certificate for %v", domains)
res, err = acmeClient.Certificate.Renew(*renew, true, false, "")
} else {
acmeClientOrderLimit.Take()
acmeClientRequestLimit.Take()
if os.Getenv("ACME_USE_RATE_LIMITS") != "false" {
acmeClientOrderLimit.Take()
acmeClientRequestLimit.Take()
}
log.Printf("Requesting new certificate for %v", domains)
res, err = acmeClient.Certificate.Obtain(certificate.ObtainRequest{
Domains: domains,