@@ -47,6 +47,12 @@ const (
47
47
cloudFlareUpdate = "UPDATE"
48
48
// defaultTTL 1 = automatic
49
49
defaultTTL = 1
50
+
51
+ // Cloudflare tier limitations https://developers.cloudflare.com/dns/manage-dns-records/reference/record-attributes/#availability
52
+ // freeZoneCommentMaxLength is the maximum length of a DNS record comment on free zones
53
+ freeZoneCommentMaxLength = 100
54
+ // paidZoneCommentMaxLength is the maximum length of a DNS record comment on paid zones
55
+ paidZoneCommentMaxLength = 500
50
56
)
51
57
52
58
// We have to use pointers to bools now, as the upstream cloudflare-go library requires them
@@ -877,16 +883,20 @@ func (p *CloudFlareProvider) newCloudFlareChange(action string, ep *endpoint.End
877
883
}
878
884
}
879
885
880
- // Free account checks https://developers.cloudflare.com/dns/manage-dns-records/reference/record-attributes/#availability
881
- if tags != nil || len (comment ) > 100 {
886
+ // Free account checks
887
+ if tags != nil || len (comment ) > freeZoneCommentMaxLength {
882
888
freeAccount := ! p .ZoneHasPaidPlan (ep .DNSName )
883
889
if freeAccount && tags != nil {
884
- log .Warnf ("DNS tags are only available for paid accounts, skipping for %s" , ep .DNSName )
890
+ log .Infof ("DNS tags are only available for paid accounts, skipping for %s" , ep .DNSName )
885
891
tags = nil
886
892
}
887
- if freeAccount && len (comment ) > 100 {
888
- log .Warnf ("DNS record comment is limited to 100 chars for free zones, trimming comment of %s" , ep .DNSName )
889
- comment = comment [:99 ]
893
+ if freeAccount && len (comment ) > freeZoneCommentMaxLength {
894
+ log .Infof ("DNS record comment is limited to %d chars for free zones, trimming comment of %s" , freeZoneCommentMaxLength , ep .DNSName )
895
+ comment = comment [:freeZoneCommentMaxLength - 1 ]
896
+ }
897
+ if len (comment ) > paidZoneCommentMaxLength {
898
+ log .Infof ("DNS record comment is limited to %d chars, trimming comment of %s" , paidZoneCommentMaxLength , ep .DNSName )
899
+ comment = comment [:paidZoneCommentMaxLength - 1 ]
890
900
}
891
901
}
892
902
0 commit comments