This commit is contained in:
mkelcik
2023-05-04 17:28:25 +02:00
parent ffd5253f59
commit f911b9ff16
4 changed files with 41 additions and 86 deletions

17
main.go
View File

@@ -18,21 +18,6 @@ type PublicIpResolver interface {
ResolvePublicIp(ctx context.Context) (net.IP, error)
}
func getNotifiers(tags []string) notifications.Notifiers {
out := notifications.Notifiers{}
for _, t := range tags {
if initFn, ok := notifications.Available[t]; ok {
notifier, err := initFn()
if err != nil {
log.Println(err)
continue
}
out = append(out, notifier)
}
}
return out
}
func getResolver(resolverName string) (PublicIpResolver, string) {
switch resolverName {
// HERE add another resolver if needed
@@ -67,7 +52,7 @@ func main() {
log.Fatal(err)
}
notifiers := getNotifiers(config.Notifiers)
notifiers := notifications.GetNotifiers(config.Notifiers)
// public ip resolver
publicIpResolver, resolverTag := getResolver(config.PublicIpResolverTag)