mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-12-09 05:36:27 +08:00
Only ALIDNS should get TTL=600
This commit is contained in:
parent
46c4ec431e
commit
a4cf909357
3 changed files with 6 additions and 4 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue