Add also-notify support for BIND domains.conf generation

Extend catz.yaml config with a bind-conf section mapping catalog names
to also-notify IP lists. Zones in catalogs with also-notify configured
get an also-notify directive in the generated domains.conf. IPs are
deduplicated and sorted when a zone belongs to multiple catalogs.
This commit is contained in:
2026-03-28 14:57:37 -07:00
parent 49f7ad2987
commit 9ff9abeabd
5 changed files with 159 additions and 11 deletions

View File

@@ -19,10 +19,16 @@ type SOAConfig struct {
Rname string `yaml:"rname"`
}
// BindConfConfig holds BIND-specific configuration for domains.conf generation.
type BindConfConfig struct {
AlsoNotify map[string][]string `yaml:"also-notify"`
}
// Config holds the parsed catz.yaml configuration.
type Config struct {
Catalogs map[string]CatalogConfig `yaml:"catalogs"`
SOA SOAConfig `yaml:"soa"`
BindConf BindConfConfig `yaml:"bind-conf"`
}
func loadConfig(path string) (*Config, error) {
@@ -66,6 +72,13 @@ func validateConfig(cfg *Config) error {
if cfg.SOA.Rname == "" {
return fmt.Errorf("config: soa.rname is required")
}
for catName := range cfg.BindConf.AlsoNotify {
if _, ok := cfg.Catalogs[catName]; !ok {
return fmt.Errorf("config: bind-conf.also-notify references unknown catalog %q", catName)
}
}
return nil
}