Skip to content

Commit

Permalink
feat: improve PropagationWait function
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Oct 2, 2024
1 parent 56986ea commit 2972278
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions challenge/dns01/precheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ func RecursiveNSsPropagationRequirement() ChallengeOption {
}
}

func PropagationWaitOnly(wait time.Duration) ChallengeOption {
func PropagationWait(wait time.Duration, only bool) ChallengeOption {
return WrapPreCheck(func(domain, fqdn, value string, check PreCheckFunc) (bool, error) {
time.Sleep(wait)
return true, nil

if only {
return true, nil
}

return check(fqdn, value)
})
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/setup_challenges.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ func setupDNS(ctx *cli.Context, client *lego.Client) error {
dns01.DisableAuthoritativeNssPropagationRequirement()),

dns01.CondOption(ctx.Duration(flgDNSPropagationWait) > 0,
dns01.PropagationWaitOnly(wait)),
// TODO(ldez): inside the next major version we will use flgDNSDisableCP here.
// This will change the meaning of this flag to really disable all propagation checks.
dns01.PropagationWait(wait, true)),

dns01.CondOption(ctx.Bool(flgDNSPropagationRNS),
dns01.RecursiveNSsPropagationRequirement()),
Expand Down

0 comments on commit 2972278

Please sign in to comment.