mirror of
https://github.com/gazer-x/komari.git
synced 2026-06-22 08:15:56 +08:00
24 lines
553 B
Go
24 lines
553 B
Go
package messageSender
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/gookit/event"
|
|
"github.com/komari-monitor/komari/internal/conf"
|
|
"github.com/komari-monitor/komari/internal/eventType"
|
|
)
|
|
|
|
func init() {
|
|
event.On(eventType.ConfigUpdated, event.ListenerFunc(func(e event.Event) error {
|
|
oldConf, newConf, err := conf.FromEvent(e)
|
|
if err != nil {
|
|
log.Printf("Failed to parse config from event: %v", err)
|
|
return err
|
|
}
|
|
if newConf.Notification.NotificationMethod != oldConf.Notification.NotificationMethod {
|
|
Initialize()
|
|
}
|
|
return nil
|
|
}), event.Max)
|
|
}
|