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

CLOUDFLARE: get-zones --ttl flag should handle CF's magic TTLs better (#657)

Fixes https://github.com/StackExchange/dnscontrol/issues/630
This commit is contained in:
Tom Limoncelli
2020-02-27 11:11:59 -05:00
committed by GitHub
parent 7789b4dbdc
commit 798cdffd81
2 changed files with 7 additions and 1 deletions

View File

@@ -79,6 +79,9 @@ func PrettySort(records models.Records, origin string, defaultTTL uint32, commen
DefaultTTL: defaultTTL,
Comments: comments,
}
if z.DefaultTTL == 0 {
z.DefaultTTL = 300
}
z.Records = nil
for _, r := range records {
z.Records = append(z.Records, r)
@@ -92,6 +95,9 @@ func (z *zoneGenData) generateZoneFileHelper(w io.Writer) error {
nameShortPrevious := ""
sort.Sort(z)
if z.DefaultTTL == 0 {
z.DefaultTTL = 300
}
fmt.Fprintln(w, "$TTL", z.DefaultTTL)
for _, comment := range z.Comments {
for _, line := range strings.Split(comment, "\n") {