Initial Notifiers implementation

This commit is contained in:
mkelcik
2023-05-04 11:44:27 +02:00
parent 2d52cbe920
commit ffd5253f59
7 changed files with 211 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ const (
envKeyCloudflareZone = "CLOUDFLARE_ZONE"
envKeyOnChangeComment = "ON_CHANGE_COMMENT"
envKeyCheckIntervalSeconds = "CHECK_INTERVAL_SECONDS"
envKeyNotifiers = "NOTIFIERS"
)
type Config struct {
@@ -25,6 +26,7 @@ type Config struct {
ApiToken string
CloudflareZone string
OnChangeComment string
Notifiers []string
CheckInterval time.Duration
}
@@ -52,11 +54,12 @@ func NewConfig() Config {
}
return Config{
DnsRecordsToCheck: parseDNSToCheck(os.Getenv(envKeyDnsToCheck)),
DnsRecordsToCheck: parseCommaDelimited(os.Getenv(envKeyDnsToCheck)),
PublicIpResolverTag: os.Getenv(envKeyPublicIpResolverTag),
ApiToken: os.Getenv(envKeyCloudflareApiKey),
CloudflareZone: os.Getenv(envKeyCloudflareZone),
OnChangeComment: os.Getenv(envKeyOnChangeComment),
Notifiers: parseCommaDelimited(os.Getenv(envKeyNotifiers)),
CheckInterval: time.Duration(checkInterval) * time.Second,
}
}