diff --git a/man/dnsmanagerd.1 b/man/dnsmanagerd.1 index 14821f7..6565399 100644 --- a/man/dnsmanagerd.1 +++ b/man/dnsmanagerd.1 @@ -14,12 +14,17 @@ daemon is a micro-service providing DNS domains and zones management. .Sh Synopsis . .Nm dnsmanagerd -.Op Fl snREh +.Op Fl snh .Op Fl v Ar verbosity .Op Fl -project Ar project-name . -.Op Fl s Ar service-name -.Op Fl r Ar path +.Op Fl -service-name Ar name +.Op Fl -storage-directory Ar path +.Op Fl -recreate-indexes +. +.Op Fl -accepted-domains Ar domains +.Op Fl -template-directory Ar dir +. .Op Fl l Ar login .Op Fl p Ar password @@ -112,7 +117,7 @@ Bool, false (see man-page) .It Li storage_directory String, -.Pa ./storage +.Pa ./db-dnsmanagerd (see .Xr dodb 7 man-page) @@ -168,14 +173,17 @@ then .It Li -h , --help Show some help, but won't cover as much as the actual manual. . -.It Li --service_name No name +.It Li --service-name No name Name of the .Xr libipc 7 unix socket used by .Xr dnsmanagerd to be contacted. -.It Fl r No storage-directory , Fl -root No directory +.It Fl -recreate-indexes +Recreate database indexes (symbolic links). + +.It Fl -storage-directory No dir Path of the directory where the .Xr dnsmanagerd database is stored. @@ -183,6 +191,23 @@ See .Xr dodb 7 for more information. . + +.It Fl -accepted-domains No domains +Accepted domains, coma separated. +.br +For example: netlib.re,example.com + +.It Fl -template-directory No dir +Directory containing domain templates which are used when creating a new domain. +Templates can be generated by +.Xr write-template-zone-file . +.br +See the following command: +.Nm "write-template-zone-file netlib.re" +.br +This command generates a file +.Pa netlib.re.json +that can be used as a template. .El Options related to the diff --git a/mk/setup.mk b/mk/setup.mk index 8cd84a8..57dc087 100644 --- a/mk/setup.mk +++ b/mk/setup.mk @@ -1,6 +1,16 @@ -DBDIR=/tmp/DATA-dnsmanagerd +DBDIR ?= /tmp/db-dnsmanagerd +TEMPLATE_DIR ?= ./templates +PASS ?= xxx run-dnsmanagerd: - $(Q)$(LOC)dnsmanagerd -v $(VERBOSITY) -r $(DBDIR) + @# Usage example. For real deployments, use a configuration file. + $(Q)$(LOC)dnsmanagerd -n -v $(VERBOSITY) \ + --storage-directory $(DBDIR) \ + --recreate-indexes \ + --service-name "dnsmanager" \ + --accepted-domains "netlib.re,example.com" \ + --template-directory $(TEMPLATE_DIR) \ + --login $(LOGIN) \ + --pass $(PASS) PORT ?= 8082 ADDR ?= diff --git a/src/config.cr b/src/config.cr index 8a461bc..af6213b 100644 --- a/src/config.cr +++ b/src/config.cr @@ -5,7 +5,7 @@ class Baguette::Configuration property login : String = "dnsmanager" property pass : String? property recreate_indexes : Bool = false - property storage_directory : String = "storage" + property storage_directory : String = "db-dnsmanagerd" # List of all accepted domains. Example: netlib.re. property accepted_domains : Array(String)? = nil diff --git a/src/main.cr b/src/main.cr index d251523..c611663 100644 --- a/src/main.cr +++ b/src/main.cr @@ -26,28 +26,43 @@ end OptionParser.parse do |parser| parser.on "-v verbosity-level", "--verbosity level", "Verbosity." do |opt| - Baguette::Log.info "Verbosity level: #{opt}" + Baguette::Log.info "Verbosity level: #{opt}." configuration.verbosity = opt.to_i end # IPC Service options - parser.on "-s service_name", "--service_name service_name", "Service name (IPC)." do |service_name| - Baguette::Log.info "Service name: #{service_name}" + parser.on "--service-name service_name", "Service name (IPC)." do |service_name| + Baguette::Log.info "Service name: #{service_name}." configuration.service_name = service_name end - parser.on "-r storage_directory", "--root storage_directory", "Storage directory." do |storage_directory| - Baguette::Log.info "Storage directory: #{storage_directory}" + parser.on "--storage-directory dir", "Storage directory." do |storage_directory| + Baguette::Log.info "Storage directory: #{storage_directory}." configuration.storage_directory = storage_directory end + parser.on "--recreate-indexes", "Recreate database indexes (symbolic links)." do + Baguette::Log.info "Recreate database indexes (symlinks)." + configuration.recreate_indexes = true + end + + parser.on "--accepted-domains domains", "Accepted domains (coma separated)." do |doms| + Baguette::Log.info "Accepted domains: #{doms}." + configuration.accepted_domains = doms.split ',' + end + + parser.on "--template-directory domains", "Default domain template directory." do |dir| + Baguette::Log.info "Default domain template directory: #{dir}." + configuration.template_directory = dir + end + parser.on "-l login", "--login login", "DNS manager authd login." do |login| - Baguette::Log.info "Authd login for dnsmanager: #{login}" + Baguette::Log.info "Authd login for dnsmanager: #{login}." configuration.login = login end parser.on "-p pass", "--pass pass", "DNS manager authd pass." do |pass| - Baguette::Log.info "Authd pass (not echoed)" + Baguette::Log.info "Authd pass (not echoed)." configuration.pass = pass end