feat: notification provider gotify

This commit is contained in:
2024-08-11 10:12:18 +02:00
parent 12898535e6
commit 9749d4a28d
4 changed files with 189 additions and 2 deletions

15
main.go
View File

@@ -2,6 +2,8 @@ package main
import (
"fmt"
"time"
"realdnydns/pkg/changeDetector"
"realdnydns/pkg/config"
"realdnydns/pkg/dnsProvider"
@@ -10,7 +12,7 @@ import (
plainExternalIpProvider "realdnydns/pkg/externalIpProvider/plain"
"realdnydns/pkg/notificationProvider"
notificationProviderConsole "realdnydns/pkg/notificationProvider/console"
"time"
gotify "realdnydns/pkg/notificationProvider/gotify"
"github.com/go-co-op/gocron"
)
@@ -54,6 +56,17 @@ func main() {
var notificationProvider notificationProvider.NotificationProvider
switch configClient.NotificationProvider.Type {
case "gotify":
var gotifyConfig gotify.NotificationProviderImplGotifyConfig
err := configClient.NotificationProvider.ProviderConfig.Decode(&gotifyConfig)
if err != nil {
panic(err)
}
notificationProvider, err = gotify.New(gotifyConfig)
if err != nil {
panic(err)
}
default:
// Use default console notification provider
notificationProvider = notificationProviderConsole.New()