mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-05-22 01:53:47 -04:00
Add mongodump args option (#6921)
* Add mongodump args option * Put mongodumpargs in proper place
This commit is contained in:
parent
42d02fdb84
commit
c202339b67
7
db.js
7
db.js
@ -3323,7 +3323,10 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
|
|
||||||
var cmd = '"' + mongoDumpPath + '"';
|
var cmd = '"' + mongoDumpPath + '"';
|
||||||
if (dburl) { cmd = '\"' + mongoDumpPath + '\" --uri=\"' + dburl + '\"'; }
|
if (dburl) { cmd = '\"' + mongoDumpPath + '\" --uri=\"' + dburl + '\"'; }
|
||||||
|
if (parent.config.settings.autobackup?.mongodumpargs) {
|
||||||
|
cmd = '\"' + mongoDumpPath + '\" ' + parent.config.settings.autobackup.mongodumpargs;
|
||||||
|
if (!parent.config.settings.autobackup.mongodumpargs.includes("--db=")) {cmd += ' --db=' + (parent.config.settings.mongodbname ? parent.config.settings.mongodbname : 'meshcentral')};
|
||||||
|
}
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3378,7 +3381,7 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
const child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) {
|
child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) {
|
||||||
if ((error != null) && (error != '')) {
|
if ((error != null) && (error != '')) {
|
||||||
func(1, "Unable to find mongodump tool, backup will not be performed. Command tried: " + cmd);
|
func(1, "Mongodump error, backup will not be performed. Command tried: " + cmd + ' --> ERROR: ' + stderr);
|
||||||
return;
|
return;
|
||||||
} else {parent.config.settings.autobackup.backupintervalhours = backupInterval;}
|
} else {parent.config.settings.autobackup.backupintervalhours = backupInterval;}
|
||||||
});
|
});
|
||||||
|
@ -886,6 +886,10 @@
|
|||||||
"default": "mongodump",
|
"default": "mongodump",
|
||||||
"description": "The file path of where \"mongodump\" is located. Default is \"mongodump\""
|
"description": "The file path of where \"mongodump\" is located. Default is \"mongodump\""
|
||||||
},
|
},
|
||||||
|
"mongoDumpArgs": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Override the default mongodump --uri=<mongoDb>. The --db= option is automatically appended if omitted. (f.e. --host=127.0.0.1 --username=someUser --password=PaSsWORD --authenticationDatabase=admin)"
|
||||||
|
},
|
||||||
"mysqlDumpPath": {
|
"mysqlDumpPath": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "mysqldump",
|
"default": "mysqldump",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user