From f878247a185013621afb92969fb36cbcad6d8f17 Mon Sep 17 00:00:00 2001 From: elcore Date: Sun, 1 Oct 2017 19:25:30 +0200 Subject: [PATCH] Implement CertRenewEvent (#1879) --- caddytls/client.go | 3 +++ plugins.go | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/caddytls/client.go b/caddytls/client.go index 091595667..3a9adae6c 100644 --- a/caddytls/client.go +++ b/caddytls/client.go @@ -345,6 +345,9 @@ func (c *ACMEClient) Renew(name string) error { return errors.New("too many renewal attempts; last error: " + err.Error()) } + // Executes Cert renew events + caddy.EmitEvent(caddy.CertRenewEvent, name) + return saveCertResource(storage, newCertMeta) } diff --git a/plugins.go b/plugins.go index 4ab1e5c4c..8fbc4ec9c 100644 --- a/plugins.go +++ b/plugins.go @@ -231,10 +231,11 @@ func RegisterPlugin(name string, plugin Plugin) { // EventName represents the name of an event used with event hooks. type EventName string -// Define the event names for the startup and shutdown events +// Define names for the various events const ( - StartupEvent EventName = "startup" - ShutdownEvent EventName = "shutdown" + StartupEvent EventName = "startup" + ShutdownEvent EventName = "shutdown" + CertRenewEvent EventName = "certrenew" ) // EventHook is a type which holds information about a startup hook plugin.