Added notification manager

This commit is contained in:
Magnus Åhall 2024-05-05 10:10:04 +02:00
parent 317c233255
commit 49af9dc33c
6 changed files with 318 additions and 51 deletions

23
notification/factory.go Normal file
View file

@ -0,0 +1,23 @@
package notification
import (
// External
werr "git.gibonuddevalla.se/go/wrappederror"
// Standard
"log/slog"
)
func ServiceFactory(t string, config []byte, prio int, ackURL string, logger *slog.Logger) (Service, error) {
switch t {
case "NTFY":
ntfy, err := NewNTFY(config, prio, ackURL)
if err != nil {
err = werr.Wrap(err).WithData(config)
return nil, err
}
return ntfy, nil
}
return nil, werr.New("Unknown notification service, '%s'", t).WithCode("002-0000")
}