add telegram and ntfy event delivery
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"orchestra/internal/authz"
|
||||
"orchestra/internal/delivery"
|
||||
"orchestra/internal/domain"
|
||||
"orchestra/internal/herdr"
|
||||
"orchestra/internal/operations"
|
||||
@@ -356,6 +357,21 @@ func main() {
|
||||
sup.Start(context.Background())
|
||||
providerHealth["jsonl"] = sup
|
||||
}
|
||||
var senders []delivery.Sender
|
||||
if token, chat := os.Getenv("ORCHESTRA_TELEGRAM_BOT_TOKEN"), os.Getenv("ORCHESTRA_TELEGRAM_CHAT_ID"); token != "" && chat != "" {
|
||||
senders = append(senders, delivery.Telegram{Token: token, ChatID: chat})
|
||||
}
|
||||
if topic := os.Getenv("ORCHESTRA_NTFY_TOPIC"); topic != "" {
|
||||
senders = append(senders, delivery.Ntfy{Topic: topic, Token: os.Getenv("ORCHESTRA_NTFY_TOKEN"), URL: os.Getenv("ORCHESTRA_NTFY_URL")})
|
||||
}
|
||||
if len(senders) > 0 {
|
||||
go func() {
|
||||
err := (&delivery.Fanout{Senders: senders}).Run(context.Background(), s.Events)
|
||||
if err != nil {
|
||||
log.Printf("delivery fanout: %v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
port := os.Getenv("ORCHESTRA_PORT")
|
||||
if port == "" {
|
||||
port = "9145"
|
||||
|
||||
Reference in New Issue
Block a user