Add a template directory for new domain templates.

master
Philippe Pittoli 2023-06-28 15:22:23 +02:00
parent cf99e73177
commit 009dcb0da7
2 changed files with 18 additions and 0 deletions

View File

@ -7,6 +7,12 @@ class Baguette::Configuration
property recreate_indexes : Bool = false
property storage_directory : String = "storage"
# New domains require to load a template so the user won't have to enter some
# necessary entries himself. For example, SOA and NS RRs should be pre-loaded
# and updated by an administrator when required.
# See tools/write-template-zone-file.cr
property template_directory : String = "/etc/dnsmanager/templates"
def initialize
end
end

View File

@ -201,6 +201,18 @@ def main
end
end
unless File.directory? configuration.template_directory
Baguette::Log.warning "template directory '#{configuration.template_directory}' doesn't exist"
if File.directory? "./templates"
Baguette::Log.info "using template directory './templates'"
configuration.template_directory = "./templates"
else
Baguette::Log.error "tried template directory './templates', but doesn't exist either"
Baguette::Log.error "no template directory detected, quitting"
exit 1
end
end
if simulation
pp! configuration
exit 0