mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
feat: replace --run-hook and --renew-hook with --deploy-hook
This commit is contained in:
parent
d2f3cc457b
commit
3969dd8b44
3 changed files with 10 additions and 13 deletions
|
|
@ -209,7 +209,7 @@ func renewForDomains(ctx context.Context, cmd *cli.Command, account *storage.Acc
|
|||
|
||||
hook.AddPathToMetadata(meta, certRes.Domain, certRes, certsStorage)
|
||||
|
||||
return hook.Launch(ctx, cmd.String(flgRenewHook), cmd.Duration(flgRenewHookTimeout), meta)
|
||||
return hook.Launch(ctx, cmd.String(flgDeployHook), cmd.Duration(flgDeployHookTimeout), meta)
|
||||
}
|
||||
|
||||
func renewForCSR(ctx context.Context, cmd *cli.Command, account *storage.Account, keyType certcrypto.KeyType, certsStorage *storage.CertificatesStorage, meta map[string]string) error {
|
||||
|
|
@ -302,7 +302,7 @@ func renewForCSR(ctx context.Context, cmd *cli.Command, account *storage.Account
|
|||
|
||||
hook.AddPathToMetadata(meta, domain, certRes, certsStorage)
|
||||
|
||||
return hook.Launch(ctx, cmd.String(flgRenewHook), cmd.Duration(flgRenewHookTimeout), meta)
|
||||
return hook.Launch(ctx, cmd.String(flgDeployHook), cmd.Duration(flgDeployHookTimeout), meta)
|
||||
}
|
||||
|
||||
func needRenewal(x509Cert *x509.Certificate, domain string, days int, dynamic bool) bool {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func run(ctx context.Context, cmd *cli.Command) error {
|
|||
|
||||
hook.AddPathToMetadata(meta, cert.Domain, cert, certsStorage)
|
||||
|
||||
return hook.Launch(ctx, cmd.String(flgRunHook), cmd.Duration(flgRunHookTimeout), meta)
|
||||
return hook.Launch(ctx, cmd.String(flgDeployHook), cmd.Duration(flgDeployHookTimeout), meta)
|
||||
}
|
||||
|
||||
func obtainCertificate(ctx context.Context, cmd *cli.Command, client *lego.Client) (*certificate.Resource, error) {
|
||||
|
|
|
|||
17
cmd/flags.go
17
cmd/flags.go
|
|
@ -88,11 +88,8 @@ const (
|
|||
|
||||
// Flags names related to hooks.
|
||||
const (
|
||||
flgRenewHook = "renew-hook"
|
||||
flgRenewHookTimeout = "renew-hook-timeout"
|
||||
|
||||
flgRunHook = "run-hook"
|
||||
flgRunHookTimeout = "run-hook-timeout"
|
||||
flgDeployHook = "deploy-hook"
|
||||
flgDeployHookTimeout = "deploy-hook-timeout"
|
||||
)
|
||||
|
||||
// Flag names related to the specific run command.
|
||||
|
|
@ -388,14 +385,14 @@ func CreateObtainFlags() []cli.Flag {
|
|||
}
|
||||
}
|
||||
|
||||
func CreateHookFlags(name, timeoutName string) []cli.Flag {
|
||||
func CreateHookFlags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: name,
|
||||
Name: flgDeployHook,
|
||||
Usage: "Define a hook. The hook is executed only when the certificates are effectively created/renewed.",
|
||||
},
|
||||
&cli.DurationFlag{
|
||||
Name: timeoutName,
|
||||
Name: flgDeployHookTimeout,
|
||||
Usage: "Define the timeout for the hook execution.",
|
||||
Value: 2 * time.Minute,
|
||||
},
|
||||
|
|
@ -418,7 +415,7 @@ func createRunFlags() []cli.Flag {
|
|||
|
||||
flags = append(flags, CreateChallengesFlags()...)
|
||||
flags = append(flags, CreateObtainFlags()...)
|
||||
flags = append(flags, CreateHookFlags(flgRunHook, flgRunHookTimeout)...)
|
||||
flags = append(flags, CreateHookFlags()...)
|
||||
|
||||
flags = append(flags,
|
||||
&cli.StringFlag{
|
||||
|
|
@ -435,7 +432,7 @@ func createRenewFlags() []cli.Flag {
|
|||
|
||||
flags = append(flags, CreateChallengesFlags()...)
|
||||
flags = append(flags, CreateObtainFlags()...)
|
||||
flags = append(flags, CreateHookFlags(flgRenewHook, flgRenewHookTimeout)...)
|
||||
flags = append(flags, CreateHookFlags()...)
|
||||
|
||||
flags = append(flags,
|
||||
&cli.IntFlag{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue