Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --forceRenew flag #336

Open
wants to merge 1 commit into
base: acmev2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ var (
revokeArg = revokeCmd.Arg("certificate-id-or-path", "Certificate ID to revoke").String()

accountThumbprintCmd = kingpin.Command("account-thumbprint", "Prints account thumbprints")


forceRenewFlag = kingpin.Flag("forceRenew", "Force renewal of certificate").Bool()
)

const reconcileHelp = `Reconcile ACME state, idempotently requesting and renewing certificates to satisfy configured targets.
Expand Down Expand Up @@ -151,6 +154,10 @@ func Main() {
log.Errore(err, "cannot load response file, continuing anyway")
}

if *forceRenewFlag {
storageops.ForceRenew = true
}

switch cmd {
case "reconcile":
cmdReconcile()
Expand Down
2 changes: 1 addition & 1 deletion storageops/reconcile-util.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func CertificateNeedsRenewing(c *storage.Certificate, t *storage.Target) bool {
}

renewTime := renewTime(cc.NotBefore, cc.NotAfter, t)
needsRenewing := !InternalClock.Now().Before(renewTime)
needsRenewing := !InternalClock.Now().Before(renewTime) || ForceRenew

log.Debugf("%v needsRenewing=%v notAfter=%v", c, needsRenewing, cc.NotAfter)
return needsRenewing
Expand Down
2 changes: 2 additions & 0 deletions storageops/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ var InternalClock = clock.Default()
// Internal use only. Used for testing purposes. Do not change.
var InternalHTTPClient *http.Client

var ForceRenew = false

// Optional configuration for the Reconcile operation.
type ReconcileConfig struct {
// If non-empty, a set of target names/paths to limit reconciliation to.
Expand Down