mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-09-20 06:46:19 +08:00
CLOUDFLAREAPI: Bugfix: Fix misaligned CF_SINGLE_REDIRECT validation (#3042)
This commit is contained in:
parent
cff63b5d75
commit
571eaf0244
|
@ -7,7 +7,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v4/models"
|
||||
"github.com/StackExchange/dnscontrol/v4/pkg/rtypecontrol"
|
||||
"github.com/StackExchange/dnscontrol/v4/pkg/transform"
|
||||
"github.com/StackExchange/dnscontrol/v4/providers"
|
||||
"github.com/miekg/dns"
|
||||
|
@ -79,7 +78,7 @@ func validateRecordTypes(rec *models.RecordConfig, domain string, pTypes []strin
|
|||
"TXT": true,
|
||||
}
|
||||
_, ok := validTypes[rec.Type]
|
||||
if !ok || rtypecontrol.IsValid(rec.Type) {
|
||||
if !ok {
|
||||
cType := providers.GetCustomRecordType(rec.Type)
|
||||
if cType == nil {
|
||||
return fmt.Errorf("unsupported record type (%v) domain=%v name=%v", rec.Type, domain, rec.GetLabel())
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package rtypecontrol
|
||||
|
||||
import "github.com/StackExchange/dnscontrol/v4/providers"
|
||||
|
||||
var validTypes = map[string]struct{}{}
|
||||
|
||||
func Register(t string) {
|
||||
|
@ -10,6 +12,7 @@ func Register(t string) {
|
|||
|
||||
validTypes[t] = struct{}{}
|
||||
|
||||
providers.RegisterCustomRecordType(t, "", "")
|
||||
}
|
||||
|
||||
func IsValid(t string) bool {
|
||||
|
|
|
@ -12,7 +12,6 @@ func PostProcess(domains []*models.DomainConfig) error {
|
|||
var err error
|
||||
|
||||
for _, dc := range domains {
|
||||
//fmt.Printf("DOMAIN: %d %s\n", len(dc.Records), dc.Name)
|
||||
|
||||
for _, rawRec := range dc.RawRecords {
|
||||
rec := &models.RecordConfig{
|
||||
|
@ -38,7 +37,6 @@ func PostProcess(domains []*models.DomainConfig) error {
|
|||
switch rawRec.Type {
|
||||
|
||||
case "CLOUDFLAREAPI_SINGLE_REDIRECT":
|
||||
rec.Name = rawRec.Args[0].(string)
|
||||
err = cfsingleredirect.FromRaw(rec, rawRec.Args)
|
||||
|
||||
default:
|
||||
|
|
|
@ -69,8 +69,6 @@ func init() {
|
|||
RecordAuditor: AuditRecords,
|
||||
}
|
||||
providers.RegisterDomainServiceProviderType("CLOUDFLAREAPI", fns, features)
|
||||
providers.RegisterCustomRecordType("rtype", "CLOUDFLAREAPI", "")
|
||||
//providers.RegisterCustomRecordType("CF_SINGLE_REDIRECT", "CLOUDFLAREAPI", "")
|
||||
providers.RegisterCustomRecordType("CF_REDIRECT", "CLOUDFLAREAPI", "")
|
||||
providers.RegisterCustomRecordType("CF_TEMP_REDIRECT", "CLOUDFLAREAPI", "")
|
||||
providers.RegisterCustomRecordType("CF_WORKER_ROUTE", "CLOUDFLAREAPI", "")
|
||||
|
|
Loading…
Reference in a new issue