Only trigger shutdown/restart events when not in dev mode

This commit is contained in:
Daniel
2021-10-11 13:34:25 +02:00
parent 4c9abbabd3
commit b3d67ecd19

View File

@@ -4,6 +4,8 @@ import (
"fmt"
"time"
"github.com/safing/portbase/config"
"github.com/safing/portbase/modules"
"github.com/safing/portbase/modules/subsystems"
"github.com/tevino/abool"
@@ -24,6 +26,7 @@ var (
module *modules.Module
restarting = abool.New()
devMode = config.Concurrent.GetAsBool(config.CfgDevModeKey, false)
)
func init() {
@@ -72,6 +75,11 @@ func registerEvents() {
}
func shutdownHook() {
// Don't trigger event in Dev Mode.
if devMode() {
return
}
// Notify everyone of the restart/shutdown.
if restarting.IsNotSet() {
module.TriggerEvent(eventShutdown, nil)