1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Refactor in preparation to unexport RecordConfig.{Name,NameFQDN,Target} (#337)

* Preparing for the unexport of Name/NameFQDN/Target
* Cleanups
This commit is contained in:
Tom Limoncelli
2018-03-19 17:18:58 -04:00
committed by GitHub
parent cd58d26545
commit a7eba97ada
37 changed files with 298 additions and 270 deletions

View File

@ -10,7 +10,6 @@ import (
"github.com/StackExchange/dnscontrol/models"
"github.com/StackExchange/dnscontrol/providers"
"github.com/StackExchange/dnscontrol/providers/diff"
"github.com/miekg/dns/dnsutil"
"github.com/pkg/errors"
dnsimpleapi "github.com/dnsimple/dnsimple-go/dnsimple"
@ -281,7 +280,7 @@ func (c *DnsimpleApi) createRecordFunc(rc *models.RecordConfig, domainName strin
return err
}
record := dnsimpleapi.ZoneRecord{
Name: dnsutil.TrimDomainName(rc.NameFQDN, domainName),
Name: rc.GetLabel(),
Type: rc.Type,
Content: rc.GetTargetCombined(),
TTL: int(rc.TTL),
@ -327,7 +326,7 @@ func (c *DnsimpleApi) updateRecordFunc(old *dnsimpleapi.ZoneRecord, rc *models.R
}
record := dnsimpleapi.ZoneRecord{
Name: dnsutil.TrimDomainName(rc.NameFQDN, domainName),
Name: rc.GetLabel(),
Type: rc.Type,
Content: rc.GetTargetCombined(),
TTL: int(rc.TTL),
@ -374,7 +373,7 @@ func removeOtherNS(dc *models.DomainConfig) {
for _, rec := range dc.Records {
if rec.Type == "NS" {
// apex NS inside dnsimple are expected.
if rec.NameFQDN == dc.Name && strings.HasSuffix(rec.GetTargetField(), ".dnsimple.com.") {
if rec.GetLabelFQDN() == dc.Name && strings.HasSuffix(rec.GetTargetField(), ".dnsimple.com.") {
continue
}
fmt.Printf("Warning: dnsimple.com does not allow NS records to be modified. %s will not be added.\n", rec.GetTargetField())