Improved connectionObject creation

Noah Zalev committed Apr 29, 2021 at 23:55 UTC 740559f2f860f63557ff3cff3c43b3907f89ff03
1 file changed +2 -9
db.js
+2 -9
@@ -443,15 +443,8 @@ module.exports.CreateDB = function (parent, func) {
443 var dbname = (connectinArgs.database != null) ? connectinArgs.database : 'meshcentral';
444
445 // Including the db name in the connection obj will cause a connection failure if it does not exist
446 - var connectionObject = {
447 - 'host': connectinArgs.host,
448 - 'port': connectinArgs.port,
449 - 'user': connectinArgs.user,
450 - 'password': connectinArgs.password,
451 - 'connectionLimit': null
452 - };
453 - if (connectinArgs.connectionLimit != null) connectionObject.connectionLimit = connectinArgs.connectionLimit;
454 -
446 + var connectionObject = Clone(connectinArgs);
447 + delete connectionObject.database;
448
449 if (parent.args.mariadb) {
450 // Use MariaDB