mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
feat: add hook-timeout to run and renew commands (#2389)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
parent
5f53d3e87d
commit
b83c1d5f64
4 changed files with 19 additions and 5 deletions
|
|
@ -25,6 +25,7 @@ const (
|
|||
flgARIWaitToRenewDuration = "ari-wait-to-renew-duration"
|
||||
flgReuseKey = "reuse-key"
|
||||
flgRenewHook = "renew-hook"
|
||||
flgRenewHookTimeout = "renew-hook-timeout"
|
||||
flgNoRandomSleep = "no-random-sleep"
|
||||
flgForceCertDomains = "force-cert-domains"
|
||||
)
|
||||
|
|
@ -109,6 +110,11 @@ func createRenew() *cli.Command {
|
|||
Name: flgRenewHook,
|
||||
Usage: "Define a hook. The hook is executed only when the certificates are effectively renewed.",
|
||||
},
|
||||
&cli.DurationFlag{
|
||||
Name: flgRenewHookTimeout,
|
||||
Usage: "Define the timeout for the hook execution.",
|
||||
Value: 2 * time.Minute,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: flgNoRandomSleep,
|
||||
Usage: "Do not add a random sleep before the renewal." +
|
||||
|
|
@ -254,7 +260,7 @@ func renewForDomains(ctx *cli.Context, account *Account, keyType certcrypto.KeyT
|
|||
|
||||
addPathToMetadata(meta, domain, certRes, certsStorage)
|
||||
|
||||
return launchHook(ctx.String(flgRenewHook), meta)
|
||||
return launchHook(ctx.String(flgRenewHook), ctx.Duration(flgRenewHookTimeout), meta)
|
||||
}
|
||||
|
||||
func renewForCSR(ctx *cli.Context, account *Account, keyType certcrypto.KeyType, certsStorage *CertificatesStorage, bundle bool, meta map[string]string) error {
|
||||
|
|
@ -337,7 +343,7 @@ func renewForCSR(ctx *cli.Context, account *Account, keyType certcrypto.KeyType,
|
|||
|
||||
addPathToMetadata(meta, domain, certRes, certsStorage)
|
||||
|
||||
return launchHook(ctx.String(flgRenewHook), meta)
|
||||
return launchHook(ctx.String(flgRenewHook), ctx.Duration(flgRenewHookTimeout), meta)
|
||||
}
|
||||
|
||||
func needRenewal(x509Cert *x509.Certificate, domain string, days int) bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue