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:
13
config.go
13
config.go
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user