CLI parameters update for consistency.

This commit is contained in:
Philippe Pittoli 2024-12-11 00:52:28 +01:00
parent f0d9104e56
commit 217211ea27
4 changed files with 66 additions and 16 deletions

View File

@ -14,12 +14,17 @@ daemon is a micro-service providing DNS domains and zones management.
.Sh Synopsis .Sh Synopsis
. .
.Nm dnsmanagerd .Nm dnsmanagerd
.Op Fl snREh .Op Fl snh
.Op Fl v Ar verbosity .Op Fl v Ar verbosity
.Op Fl -project Ar project-name .Op Fl -project Ar project-name
. .
.Op Fl s Ar service-name .Op Fl -service-name Ar name
.Op Fl r Ar path .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 l Ar login
.Op Fl p Ar password .Op Fl p Ar password
@ -112,7 +117,7 @@ Bool, false (see
man-page) man-page)
.It Li storage_directory .It Li storage_directory
String, String,
.Pa ./storage .Pa ./db-dnsmanagerd
(see (see
.Xr dodb 7 .Xr dodb 7
man-page) man-page)
@ -168,14 +173,17 @@ then
.It Li -h , --help .It Li -h , --help
Show some help, but won't cover as much as the actual manual. 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 Name of the
.Xr libipc 7 .Xr libipc 7
unix socket used by unix socket used by
.Xr dnsmanagerd .Xr dnsmanagerd
to be contacted. 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 Path of the directory where the
.Xr dnsmanagerd .Xr dnsmanagerd
database is stored. database is stored.
@ -183,6 +191,23 @@ See
.Xr dodb 7 .Xr dodb 7
for more information. 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 .El
Options related to the Options related to the

View File

@ -1,6 +1,16 @@
DBDIR=/tmp/DATA-dnsmanagerd DBDIR ?= /tmp/db-dnsmanagerd
TEMPLATE_DIR ?= ./templates
PASS ?= xxx
run-dnsmanagerd: 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 PORT ?= 8082
ADDR ?= ADDR ?=

View File

@ -5,7 +5,7 @@ class Baguette::Configuration
property login : String = "dnsmanager" property login : String = "dnsmanager"
property pass : String? property pass : String?
property recreate_indexes : Bool = false property recreate_indexes : Bool = false
property storage_directory : String = "storage" property storage_directory : String = "db-dnsmanagerd"
# List of all accepted domains. Example: netlib.re. # List of all accepted domains. Example: netlib.re.
property accepted_domains : Array(String)? = nil property accepted_domains : Array(String)? = nil

View File

@ -26,28 +26,43 @@ end
OptionParser.parse do |parser| OptionParser.parse do |parser|
parser.on "-v verbosity-level", "--verbosity level", "Verbosity." do |opt| 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 configuration.verbosity = opt.to_i
end end
# IPC Service options # IPC Service options
parser.on "-s service_name", "--service_name service_name", "Service name (IPC)." do |service_name| parser.on "--service-name service_name", "Service name (IPC)." do |service_name|
Baguette::Log.info "Service name: #{service_name}" Baguette::Log.info "Service name: #{service_name}."
configuration.service_name = service_name configuration.service_name = service_name
end end
parser.on "-r storage_directory", "--root storage_directory", "Storage directory." do |storage_directory| parser.on "--storage-directory dir", "Storage directory." do |storage_directory|
Baguette::Log.info "Storage directory: #{storage_directory}" Baguette::Log.info "Storage directory: #{storage_directory}."
configuration.storage_directory = storage_directory configuration.storage_directory = storage_directory
end 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| 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 configuration.login = login
end end
parser.on "-p pass", "--pass pass", "DNS manager authd pass." do |pass| 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 configuration.pass = pass
end end