mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-26 16:06:33 +03:00
Include dbname in mysql/mariadb connectionObj
This commit is contained in:
parent
8674f8eb02
commit
4c34797915
15
db.js
15
db.js
@ -439,13 +439,24 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parent.args.mariadb || parent.args.mysql) {
|
if (parent.args.mariadb || parent.args.mysql) {
|
||||||
|
var connectinArgs = (parent.args.mariadb) ? parent.args.mariadb : parent.args.mysql;
|
||||||
|
var connectionObject = {
|
||||||
|
'host': connectinArgs.host,
|
||||||
|
'port': connectinArgs.port,
|
||||||
|
'user': connectinArgs.user,
|
||||||
|
'password': connectinArgs.password,
|
||||||
|
'connectionLimit': null,
|
||||||
|
'database': null
|
||||||
|
};
|
||||||
|
if (connectinArgs.connectionLimit != null) connectionObject.connectionLimit = connectinArgs.connectionLimit;
|
||||||
|
connectionObject.database = (connectinArgs.database != null) ? connectinArgs.database : 'meshcentral';
|
||||||
if (parent.args.mariadb) {
|
if (parent.args.mariadb) {
|
||||||
// Use MariaDB
|
// Use MariaDB
|
||||||
obj.databaseType = 4;
|
obj.databaseType = 4;
|
||||||
Datastore = require('mariadb').createPool(parent.args.mariadb);
|
Datastore = require('mariadb').createPool(connectionObject);
|
||||||
} else if (parent.args.mysql) {
|
} else if (parent.args.mysql) {
|
||||||
// Use MySQL
|
// Use MySQL
|
||||||
Datastore = require('mysql').createConnection(parent.args.mysql);
|
Datastore = require('mysql').createConnection(connectionObject);
|
||||||
obj.databaseType = 5;
|
obj.databaseType = 5;
|
||||||
}
|
}
|
||||||
//sqlDbQuery('DROP DATABASE MeshCentral', null, function (err, docs) { console.log('DROP'); }); return;
|
//sqlDbQuery('DROP DATABASE MeshCentral', null, function (err, docs) { console.log('DROP'); }); return;
|
||||||
|
Loading…
Reference in New Issue
Block a user