append zone root to domains without .
This commit is contained in:
parent
bf950f10ac
commit
19d67c2209
|
@ -8,6 +8,7 @@ import (
|
|||
"gopkg.in/yaml.v2"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ZoneConfig struct {
|
||||
|
@ -80,6 +81,9 @@ func LoadZone(path string) (*Zone, error) {
|
|||
return nil, errors.New("A record TTL cannot be 0 or empty")
|
||||
}
|
||||
for _, domain := range record.Domains {
|
||||
if !strings.HasSuffix(domain, ".") {
|
||||
domain = domain + "." + cfg.Zone.Root + "."
|
||||
}
|
||||
zone.ARecords = append(zone.ARecords, RecordA{
|
||||
In: domain,
|
||||
Ip: record.Ipv4.To4(),
|
||||
|
@ -98,6 +102,9 @@ func LoadZone(path string) (*Zone, error) {
|
|||
return nil, errors.New("AAAA record TTL cannot be 0 or empty")
|
||||
}
|
||||
for _, domain := range record.Domains {
|
||||
if !strings.HasSuffix(domain, ".") {
|
||||
domain = domain + "." + cfg.Zone.Root + "."
|
||||
}
|
||||
zone.AAAARecords = append(zone.AAAARecords, RecordAAAA{
|
||||
In: domain,
|
||||
Ip: record.Ipv6,
|
||||
|
@ -116,6 +123,9 @@ func LoadZone(path string) (*Zone, error) {
|
|||
return nil, errors.New("CNAME record TTL cannot be 0 or empty")
|
||||
}
|
||||
for _, domain := range record.Domains {
|
||||
if !strings.HasSuffix(domain, ".") {
|
||||
domain = domain + "." + cfg.Zone.Root + "."
|
||||
}
|
||||
zone.CNAMERecords = append(zone.CNAMERecords, RecordCNAME{
|
||||
In: domain,
|
||||
Target: record.Target,
|
||||
|
@ -134,6 +144,9 @@ func LoadZone(path string) (*Zone, error) {
|
|||
return nil, errors.New("TXT record TTL cannot be 0 or empty")
|
||||
}
|
||||
for _, domain := range record.Domains {
|
||||
if !strings.HasSuffix(domain, ".") {
|
||||
domain = domain + "." + cfg.Zone.Root + "."
|
||||
}
|
||||
zone.TXTRecords = append(zone.TXTRecords, RecordTXT{
|
||||
In: domain,
|
||||
Content: record.Content,
|
||||
|
|
Loading…
Reference in New Issue