mirror of
https://github.com/safing/portbase
synced 2025-04-17 16:09:08 +00:00
Expose config change event name
This commit is contained in:
parent
48711570af
commit
055c220a58
3 changed files with 5 additions and 6 deletions
|
@ -80,7 +80,7 @@ func registerBasicOptions() error {
|
|||
// Register to hook to update the log level.
|
||||
if err := module.RegisterEventHook(
|
||||
"config",
|
||||
configChangeEvent,
|
||||
ChangeEvent,
|
||||
"update log level",
|
||||
setLogLevel,
|
||||
); err != nil {
|
||||
|
|
|
@ -16,9 +16,8 @@ import (
|
|||
"github.com/safing/portbase/utils/debug"
|
||||
)
|
||||
|
||||
const (
|
||||
configChangeEvent = "config change"
|
||||
)
|
||||
// ChangeEvent is the name of the config change event.
|
||||
const ChangeEvent = "config change"
|
||||
|
||||
var (
|
||||
module *modules.Module
|
||||
|
@ -36,7 +35,7 @@ func SetDataRoot(root *utils.DirStructure) {
|
|||
|
||||
func init() {
|
||||
module = modules.Register("config", prep, start, nil, "database")
|
||||
module.RegisterEvent(configChangeEvent, true)
|
||||
module.RegisterEvent(ChangeEvent, true)
|
||||
|
||||
flag.BoolVar(&exportConfig, "export-config-options", false, "export configuration registry and exit")
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ func signalChanges() {
|
|||
validityFlag = abool.NewBool(true)
|
||||
validityFlagLock.Unlock()
|
||||
|
||||
module.TriggerEvent(configChangeEvent, nil)
|
||||
module.TriggerEvent(ChangeEvent, nil)
|
||||
}
|
||||
|
||||
// replaceConfig sets the (prioritized) user defined config.
|
||||
|
|
Loading…
Add table
Reference in a new issue