1
0
mirror of https://github.com/go-acme/lego.git synced 2024-12-22 07:12:22 +02:00

fix(cli): use retryable client for ACME server calls (#2368)

This commit is contained in:
Ludovic Fernandez 2024-12-10 15:02:07 +01:00 committed by GitHub
parent 0bbf5ab59c
commit 65250372ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@ import (
"github.com/go-acme/lego/v4/lego"
"github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/registration"
"github.com/hashicorp/go-retryablehttp"
"github.com/urfave/cli/v2"
)
@ -65,6 +66,12 @@ func newClient(ctx *cli.Context, acc registration.User, keyType certcrypto.KeyTy
}
}
retryClient := retryablehttp.NewClient()
retryClient.RetryMax = 5
retryClient.HTTPClient = config.HTTPClient
config.HTTPClient = retryClient.StandardClient()
client, err := lego.NewClient(config)
if err != nil {
log.Fatalf("Could not create client: %v", err)