@@ -16,6 +16,8 @@ port=$2
1616PORT=$port
1717user=$3
1818USER=$user
19+ hash=$user
20+ HASH=$user
1921password=$4 ; HIDE=4
2022PASSWORD=$password
2123type=${5-api}
@@ -33,9 +35,14 @@ source $HESTIA/conf/hestia.conf
3335# Verifications #
3436# ----------------------------------------------------------#
3537
36- args_usage=' HOST PORT USER PASSWORD [TYPE] [DNS_USER]'
37- check_args ' 4' " $# " " $args_usage "
38- is_format_valid ' host' ' port' ' user' ' type' ' dns_user'
38+ args_usage=' HOST PORT USER [PASSWORD] [TYPE] [DNS_USER]'
39+ check_args ' 3' " $# " " $args_usage "
40+ is_format_valid ' host' ' port' ' type' ' dns_user'
41+ if [ -z " $password " ]; then
42+ is_format_valid ' hash'
43+ else
44+ is_format_valid ' user'
45+ fi
3946is_system_enabled " $DNS_SYSTEM " ' DNS_SYSTEM'
4047is_password_valid
4148is_dnshost_new
@@ -51,10 +58,17 @@ time_n_date=$(date +'%T %F')
5158time=$( echo " $time_n_date " | cut -f 1 -d \ )
5259date=$( echo " $time_n_date " | cut -f 2 -d \ )
5360
54- # Concatentating dns host string
55- str=" HOST='$host ' PORT='$port ' USER='$user ' PASSWORD='$password '"
56- str=" $str DNS_USER='$dns_user ' TYPE='$type ' SUSPENDED='no'"
57- str=" $str TIME='$time ' DATE='$date '"
61+ if [ -z " $password " ]; then
62+ # Concatentating dns host string
63+ str=" HOST='$host ' PORT='$port ' HASH='$hash '"
64+ str=" $str DNS_USER='$dns_user ' TYPE='$type ' SUSPENDED='no'"
65+ str=" $str TIME='$time ' DATE='$date '"
66+ else
67+ # Concatentating dns host string
68+ str=" HOST='$host ' PORT='$port ' USER='$user ' PASSWORD='$password '"
69+ str=" $str DNS_USER='$dns_user ' TYPE='$type ' SUSPENDED='no'"
70+ str=" $str TIME='$time ' DATE='$date '"
71+ fi
5872
5973# Adding host to dns-cluster.conf
6074echo " $str " >> $HESTIA /conf/dns-cluster.conf
0 commit comments