syslog reconfiguration

This commit is contained in:
Paolo Asperti 2022-06-03 15:59:35 +02:00
parent e2d92daf31
commit e5bcea3ec3
Signed by: paspo
GPG Key ID: 06D46905D19D5182
2 changed files with 5 additions and 1 deletions

View File

@ -25,7 +25,7 @@ func init() {
config.SetDefault(k, v)
}
Connected = false
events.AddListener("config_changed", Reconfigure)
events.AddListener("syslog_config_changed", Reconfigure)
go Connect()
}
@ -56,6 +56,7 @@ func Connect() {
Err(fmt.Sprintf("failed to connect to syslog: %s", err.Error()))
time.Sleep(1 * time.Second)
go Connect()
return
}
switch format {

View File

@ -4,6 +4,7 @@ import (
"strings"
"git.openpdu.org/OpenPDU/openpdu/config"
"git.openpdu.org/OpenPDU/openpdu/events"
"git.openpdu.org/OpenPDU/openpdu/syslog"
"gopkg.in/macaron.v1"
)
@ -39,5 +40,7 @@ func syslogPost(ctx *macaron.Context, f SyslogPostForm) {
config.Set("Syslog.Format", strings.TrimSpace(f.Format))
config.WriteConfig()
events.FireEvent("syslog_config_changed")
syslogPage(ctx)
}