24 lines
491 B
Go
24 lines
491 B
Go
|
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")
|
||
|
}
|