Added notification manager
This commit is contained in:
parent
317c233255
commit
49af9dc33c
6 changed files with 318 additions and 51 deletions
23
notification/factory.go
Normal file
23
notification/factory.go
Normal 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")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue