mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-10-06 11:56:50 +08:00
CLOUDFLAREAPI: Future-proof how ALIAS is handled (#3436)
This commit is contained in:
parent
2c4cc0c5e5
commit
2c56f68783
1 changed files with 13 additions and 5 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue