Adds configuration from config file.

This commit is contained in:
2022-02-07 15:02:06 -06:00
parent b7ed5a30c2
commit ba892ce475
9 changed files with 331 additions and 231 deletions

View File

@ -16,11 +16,11 @@ func buildBindResponsePolicyFile() {
outputTemplate := `{{- $domain := .Domain -}}
$TTL {{ or .TTL "1h" }}
@ IN SOA {{ $domain }}. {{ or .Email "domain-admin" }}. (
{{ or .Timestamp "0000000000" }} ; Serial
{{ or .Refresh "1h" }} ; Refresh
{{ or .Retry "30m" }} ; Retry
{{ or .Expire "1w" }} ; Expire
{{ or .Minimum "1h" }} ; Minimum
{{ or .Serial "0000000000" }} ; Serial
{{ or .Refresh "1h" }} ; Refresh
{{ or .Retry "30m" }} ; Retry
{{ or .Expire "1w" }} ; Expire
{{ or .Minimum "1h" }} ; Minimum
)
;
@ -33,7 +33,7 @@ $TTL {{ or .TTL "1h" }}
;
; Addresses
;
{{- range .BadDomains }}
{{- range .BlockedDomains }}
{{ . }} IN CNAME blocked.{{ $domain }}.
{{- end }}`
@ -42,7 +42,7 @@ $TTL {{ or .TTL "1h" }}
log.Fatalf("[FATAL] Unable to parse template (%s): %v\n", "response-policy-zone", err)
}
if err := t.Execute(&output, config.NamedConfig); err != nil {
if err := t.Execute(&output, config.Config.ZoneConfig); err != nil {
log.Fatalf("[FATAL] Unable to generate template output: %v\n", err)
}