Skip to content

Commit 83b7110

Browse files
committed
include new db type in vesta config
1 parent 567ce7e commit 83b7110

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

bin/v-add-database-host

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ is_pgsql_host_alive() {
6565
args_usage='TYPE HOST DBUSER DBPASS [MAX_DB] [CHARSETS] [TPL]'
6666
check_args '4' "$#" "$args_usage"
6767
validate_format 'host' 'dbuser' 'max_db' 'charsets' 'template'
68-
is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
69-
is_type_valid "$DB_SYSTEM" "$type"
68+
#is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
69+
#is_type_valid "$DB_SYSTEM" "$type"
7070
is_dbhost_new
7171
is_password_valid
7272
dbpass="$password"
@@ -91,15 +91,28 @@ case $type in
9191
str="$str TIME='$TIME' DATE='$DATE'";;
9292
esac
9393

94-
# Adding host to conf
95-
echo "$str" >> $VESTA/conf/$type.conf
96-
chmod 660 $VESTA/conf/$type.conf
9794

9895

9996
#----------------------------------------------------------#
10097
# Vesta #
10198
#----------------------------------------------------------#
10299

100+
# Adding host to conf
101+
echo "$str" >> $VESTA/conf/$type.conf
102+
chmod 660 $VESTA/conf/$type.conf
103+
104+
# Updating vesta.conf
105+
if [ -z "$(grep DB_SYSTEM $VESTA/conf/vesta.conf)" ]; then
106+
echo "DB_SYSTEM='$type'" >> $VESTA/conf/vesta.conf
107+
else
108+
db=$(echo "$DB_SYSTEM,$type" |\
109+
sed "s/,/\n/g"|\
110+
sort -r -u |\
111+
sed "/^$/d"|\
112+
sed ':a;N;$!ba;s/\n/,/g')
113+
sed -i "s/DB_SYSTEM=.*/DB_SYSTEM='$db'/g" $VESTA/conf/vesta.conf
114+
fi
115+
103116
# Logging
104117
log_event "$OK" "$EVENT"
105118

0 commit comments

Comments
 (0)