Skip to content

feat(cloudflare): Enable DNS record Comment and Tags #5359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions provider/cloudflare/cloudflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -874,27 +874,25 @@ func (p *CloudFlareProvider) newCloudFlareChange(action string, ep *endpoint.End
}

comment := p.DNSRecordsConfig.Comment
tags := p.DNSRecordsConfig.GetTags()
antComment, ok := ep.GetProviderSpecificProperty(source.CloudflareRecordCommentKey)
if ok {
comment = antComment
if val, ok := ep.GetProviderSpecificProperty(source.CloudflareRecordCommentKey); ok {
comment = val
}

if len(comment) > paidZoneCommentMaxLength {
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)
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)
comment = comment[:paidZoneCommentMaxLength-1]
}

antTags, ok := ep.GetProviderSpecificProperty(source.CloudflareRecordTagsKey)
if ok {
tags = strings.Split(antTags, ",")
tags := p.DNSRecordsConfig.GetTags()
if val, ok := ep.GetProviderSpecificProperty(source.CloudflareRecordTagsKey); ok {
tags = strings.Split(val, ",")
}

// Free account checks
if tags != nil || len(comment) > freeZoneCommentMaxLength {
free := !p.ZoneHasPaidPlan(ep.DNSName)
if free && tags != nil {
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)
log.Infof("DNS tags are only available for paid accounts, skipping for %s.", ep.DNSName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a warning

tags = nil
}
if free && len(comment) > freeZoneCommentMaxLength {
Expand Down
Loading