Skip to content

Commit def76d6

Browse files
committed
Improve log + Conditional syntax
1 parent 299db8d commit def76d6

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

provider/cloudflare/cloudflare.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -874,27 +874,25 @@ func (p *CloudFlareProvider) newCloudFlareChange(action string, ep *endpoint.End
874874
}
875875

876876
comment := p.DNSRecordsConfig.Comment
877-
tags := p.DNSRecordsConfig.GetTags()
878-
antComment, ok := ep.GetProviderSpecificProperty(source.CloudflareRecordCommentKey)
879-
if ok {
880-
comment = antComment
877+
if val, ok := ep.GetProviderSpecificProperty(source.CloudflareRecordCommentKey); ok {
878+
comment = val
881879
}
882880

883881
if len(comment) > paidZoneCommentMaxLength {
884-
log.Warnf("DNS record comment is invalid. Trimming comment of %s. To avoid endless syncs, please set it to less than %d for free zones and less than %d for paid zones.", ep.DNSName, freeZoneCommentMaxLength, paidZoneCommentMaxLength)
882+
log.Warnf("DNS record comment is invalid. Trimming comment of %s. To avoid endless syncs, please set it to less than %d chars for free zones and less than %d chars for paid zones.", ep.DNSName, freeZoneCommentMaxLength, paidZoneCommentMaxLength)
885883
comment = comment[:paidZoneCommentMaxLength-1]
886884
}
887885

888-
antTags, ok := ep.GetProviderSpecificProperty(source.CloudflareRecordTagsKey)
889-
if ok {
890-
tags = strings.Split(antTags, ",")
886+
tags := p.DNSRecordsConfig.GetTags()
887+
if val, ok := ep.GetProviderSpecificProperty(source.CloudflareRecordTagsKey); ok {
888+
tags = strings.Split(val, ",")
891889
}
892890

893891
// Free account checks
894892
if tags != nil || len(comment) > freeZoneCommentMaxLength {
895893
free := !p.ZoneHasPaidPlan(ep.DNSName)
896894
if free && tags != nil {
897-
log.Warnf("DNS tags are only available for paid accounts, skipping for %s. Please remove it from the config to avoid endless syncs.", ep.DNSName)
895+
log.Infof("DNS tags are only available for paid accounts, skipping for %s.", ep.DNSName)
898896
tags = nil
899897
}
900898
if free && len(comment) > freeZoneCommentMaxLength {

0 commit comments

Comments
 (0)