0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-01-06 22:40:31 -05:00

core: instance restart (reload) event (#2178)

This commit is contained in:
Denis 2018-06-13 02:00:53 +03:00 committed by Matt Holt
parent e54dfa49c3
commit 6965075825
2 changed files with 5 additions and 3 deletions

View file

@ -263,9 +263,10 @@ type EventName string
// Define names for the various events // Define names for the various events
const ( const (
StartupEvent EventName = "startup" StartupEvent EventName = "startup"
ShutdownEvent EventName = "shutdown" ShutdownEvent = "shutdown"
CertRenewEvent EventName = "certrenew" CertRenewEvent = "certrenew"
InstanceStartupEvent EventName = "instancestartup" InstanceStartupEvent = "instancestartup"
InstanceRestartEvent = "instancerestart"
) )
// EventHook is a type which holds information about a startup hook plugin. // EventHook is a type which holds information about a startup hook plugin.

View file

@ -90,6 +90,7 @@ func trapSignalsPosix() {
purgeEventHooks() purgeEventHooks()
// Kick off the restart; our work is done // Kick off the restart; our work is done
EmitEvent(InstanceRestartEvent, nil)
_, err = inst.Restart(caddyfileToUse) _, err = inst.Restart(caddyfileToUse)
if err != nil { if err != nil {
restoreEventHooks(oldEventHooks) restoreEventHooks(oldEventHooks)