feat(config): add links and dns settings
- links: short names mapped to host selectors, validated against chains and static host names - dns.suggest / dns.save_link: ask, always or never - dns.domains: domain rules per name pattern (mx* -> easysahre.de) - the wizard edits the dns settings under Resolver & cache and keeps links; setup.SaveTo reports to a chosen writer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c408d529a0
commit
5c41a5eb6f
6 files changed
+290
-6
No files matched your search
@@ -106,3 +106,15 @@ func TestTUIColumnsValidation(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDNSConfigValidation(t *testing.T) {
|
||||
cfg := loadFromDir(t, writeConfig(t, "netbox:\n url: https://nb\ndns:\n suggest: Always\n domains:\n - match: \"mx*\"\n domain: easysahre.de\n"))
|
||||
if cfg.DNS.SuggestMode() != DNSAlways || cfg.DNS.SaveLinkMode() != DNSAsk || len(cfg.DNS.Domains) != 1 {
|
||||
t.Fatalf("dns: %+v", cfg.DNS)
|
||||
}
|
||||
for _, bad := range []DNSConfig{{Suggest: "sometimes"}, {SaveLink: "yes"}, {Domains: []DNSDomain{{Match: "[", Domain: "a.de"}}}, {Domains: []DNSDomain{{Domain: " "}}}, {Domains: []DNSDomain{{Domain: "a b.de"}}}} {
|
||||
if err := (&Config{DNS: bad}).ValidateDNS(); err == nil {
|
||||
t.Errorf("%+v accepted", bad)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user