From 65250372eea535b0b38917bc3b9bf78c833390d3 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Tue, 10 Dec 2024 15:02:07 +0100 Subject: [PATCH] fix(cli): use retryable client for ACME server calls (#2368) --- cmd/setup.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/setup.go b/cmd/setup.go index 5e878827d4..3fc05038e6 100644 --- a/cmd/setup.go +++ b/cmd/setup.go @@ -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)