Merge branch 'main' into chore-cleanup
All checks were successful
CI / test (pull_request) Successful in 1m48s
All checks were successful
CI / test (pull_request) Successful in 1m48s
This commit is contained in:
26
main.go
26
main.go
@@ -2,13 +2,17 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"realdnydns/pkg/changeDetector"
|
||||
"realdnydns/pkg/config"
|
||||
"realdnydns/pkg/dnsProvider"
|
||||
ionos "realdnydns/pkg/dnsProvider/ionos"
|
||||
"realdnydns/pkg/externalIpProvider"
|
||||
plainExternalIpProvider "realdnydns/pkg/externalIpProvider/plain"
|
||||
"time"
|
||||
"realdnydns/pkg/notificationProvider"
|
||||
notificationProviderConsole "realdnydns/pkg/notificationProvider/console"
|
||||
gotify "realdnydns/pkg/notificationProvider/gotify"
|
||||
|
||||
"github.com/go-co-op/gocron"
|
||||
)
|
||||
@@ -53,7 +57,25 @@ func main() {
|
||||
panic(fmt.Errorf("unknown DNS provider: %s", configClient.DNSProvider.Type))
|
||||
}
|
||||
|
||||
changeDetector := changeDetector.New(externalIpProvider, dnsProvider, configClient.Domains)
|
||||
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()
|
||||
}
|
||||
|
||||
changeDetector := changeDetector.New(externalIpProvider, dnsProvider, notificationProvider, configClient.Domains)
|
||||
|
||||
s := gocron.NewScheduler(time.UTC)
|
||||
s.SingletonMode()
|
||||
|
||||
Reference in New Issue
Block a user