Only ALIDNS should get TTL=600

This commit is contained in:
Thomas Limoncelli 2025-12-03 15:35:46 -05:00
parent 46c4ec431e
commit a4cf909357
No known key found for this signature in database
3 changed files with 6 additions and 4 deletions

View file

@ -433,7 +433,7 @@ func loc(name string, d1 uint8, m1 uint8, s1 float32, ns string,
func makeRec(name, target, typ string) *models.RecordConfig { func makeRec(name, target, typ string) *models.RecordConfig {
r := &models.RecordConfig{ r := &models.RecordConfig{
Type: typ, Type: typ,
TTL: 600, TTL: models.DefaultTTL,
} }
SetLabel(r, name, "**current-domain**.") SetLabel(r, name, "**current-domain**.")
r.MustSetTarget(target) r.MustSetTarget(target)

View file

@ -9,6 +9,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/StackExchange/dnscontrol/v4/models"
"github.com/StackExchange/dnscontrol/v4/pkg/credsfile" "github.com/StackExchange/dnscontrol/v4/pkg/credsfile"
"github.com/StackExchange/dnscontrol/v4/providers" "github.com/StackExchange/dnscontrol/v4/providers"
"github.com/StackExchange/dnscontrol/v4/providers/cloudflare" "github.com/StackExchange/dnscontrol/v4/providers/cloudflare"
@ -117,6 +118,10 @@ func getProvider(t *testing.T) (providers.DNSServiceProvider, string, map[string
metadata = []byte(`{ ` + strings.Join(items, `, `) + ` }`) metadata = []byte(`{ ` + strings.Join(items, `, `) + ` }`)
} }
if profileType == "ALIDNS" {
models.DefaultTTL = 600
}
provider, err := providers.CreateDNSProvider(profileType, cfg, metadata) provider, err := providers.CreateDNSProvider(profileType, cfg, metadata)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View file

@ -6,14 +6,11 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/StackExchange/dnscontrol/v4/models"
"github.com/StackExchange/dnscontrol/v4/providers" "github.com/StackExchange/dnscontrol/v4/providers"
_ "github.com/StackExchange/dnscontrol/v4/providers/_all" _ "github.com/StackExchange/dnscontrol/v4/providers/_all"
) )
func TestDNSProviders(t *testing.T) { func TestDNSProviders(t *testing.T) {
models.DefaultTTL = 600 // Avoid problems due to minimum TTLs
provider, domain, cfg := getProvider(t) provider, domain, cfg := getProvider(t)
if provider == nil { if provider == nil {
return return