CLOUDFLAREAPI: Future-proof how ALIAS is handled (#3436)

This commit is contained in:
Tom Limoncelli 2025-02-14 16:01:30 -05:00 committed by GitHub
parent 2c4cc0c5e5
commit 2c56f68783
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -443,6 +443,13 @@ func checkProxyVal(v string) (string, error) {
}
func (c *cloudflareProvider) preprocessConfig(dc *models.DomainConfig) error {
for _, rec := range dc.Records {
if rec.Type == "ALIAS" {
rec.Type = "CNAME"
}
}
// Determine the default proxy setting.
var defProxy string
var err error
@ -811,6 +818,12 @@ func stringDefault(value interface{}, def string) string {
}
func (c *cloudflareProvider) nativeToRecord(domain string, cr cloudflare.DNSRecord) (*models.RecordConfig, error) {
// workaround for https://github.com/StackExchange/dnscontrol/issues/446
if cr.Type == "SPF" {
cr.Type = "TXT"
}
// normalize cname,mx,ns records with dots to be consistent with our config format.
if cr.Type == "ALIAS" || cr.Type == "CNAME" || cr.Type == "MX" || cr.Type == "NS" || cr.Type == "PTR" {
if cr.Content != "." {
@ -825,11 +838,6 @@ func (c *cloudflareProvider) nativeToRecord(domain string, cr cloudflare.DNSReco
}
rc.SetLabelFromFQDN(cr.Name, domain)
// workaround for https://github.com/StackExchange/dnscontrol/issues/446
if cr.Type == "SPF" {
cr.Type = "TXT"
}
if cr.Type == "A" || cr.Type == "AAAA" || cr.Type == "CNAME" {
if cr.Proxied != nil {
if *(cr.Proxied) {