Add a template directory for new domain templates.
parent
cf99e73177
commit
009dcb0da7
|
@ -7,6 +7,12 @@ class Baguette::Configuration
|
||||||
property recreate_indexes : Bool = false
|
property recreate_indexes : Bool = false
|
||||||
property storage_directory : String = "storage"
|
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
|
def initialize
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
12
src/main.cr
12
src/main.cr
|
@ -201,6 +201,18 @@ def main
|
||||||
end
|
end
|
||||||
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
|
if simulation
|
||||||
pp! configuration
|
pp! configuration
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue