mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-10 17:38:13 +08: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:
parent
7789b4dbdc
commit
798cdffd81
2 changed files with 7 additions and 1 deletions
|
@ -165,7 +165,7 @@ func GetZone(args GetZoneArgs) error {
|
|||
if defaultTTL == 0 {
|
||||
defaultTTL = prettyzone.MostCommonTTL(recs)
|
||||
}
|
||||
if defaultTTL != models.DefaultTTL {
|
||||
if defaultTTL != models.DefaultTTL && defaultTTL != 0 {
|
||||
fmt.Fprintf(w, "\n\tDefaultTTL(%d)", defaultTTL)
|
||||
}
|
||||
for _, rec := range recs {
|
||||
|
|
|
@ -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") {
|
||||
|
|
Loading…
Reference in a new issue