mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 06:05:53 -05:00
Added MongoDbChangeStream option.
This commit is contained in:
parent
8416b0a0aa
commit
162de5153b
6
db.js
6
db.js
@ -230,8 +230,8 @@ module.exports.CreateDB = function (parent, func) {
|
||||
});
|
||||
|
||||
// Setup the changeStream on the MongoDB main collection if possible
|
||||
try {
|
||||
obj.fileChangeStream = obj.file.watch([{ $match: { 'fullDocument.type': { $in: [ 'node', 'mesh', 'user' ] } } }], { fullDocument: 'updateLookup' });
|
||||
if (parent.args.mongodbchangestream == true) {
|
||||
obj.fileChangeStream = obj.file.watch([{ $match: { 'fullDocument.type': { $in: ['node', 'mesh', 'user'] } } }], { fullDocument: 'updateLookup' });
|
||||
obj.fileChangeStream.on('change', function (change) {
|
||||
switch (change.fullDocument.type) {
|
||||
case 'node': { dbNodeChange(change); break; } // A node has changed
|
||||
@ -240,7 +240,7 @@ module.exports.CreateDB = function (parent, func) {
|
||||
}
|
||||
});
|
||||
obj.changeStream = true;
|
||||
} catch (ex) { }
|
||||
}
|
||||
|
||||
// Setup MongoDB events collection and indexes
|
||||
obj.eventsfile = db.collection('events'); // Collection containing all events
|
||||
|
@ -869,12 +869,12 @@ function CreateMeshCentralServer(config, args) {
|
||||
obj.updateServerState('state', 'running');
|
||||
|
||||
// Setup auto-backup defaults
|
||||
if (obj.config.settings.autobackup == null) { obj.config.settings.autobackup = { backupinvervalhours: 24, keeplastdaysbackup: 10 }; }
|
||||
if (obj.config.settings.autobackup == null) { obj.config.settings.autobackup = { backupintervalhours: 24, keeplastdaysbackup: 10 }; }
|
||||
else if (obj.config.settings.autobackup === false) { delete obj.config.settings.autobackup; }
|
||||
|
||||
// Setup auto-backup timer
|
||||
if (obj.config.settings.autobackup && (typeof obj.config.settings.autobackup.backupinvervalhours == 'number')) {
|
||||
setInterval(obj.db.performBackup, obj.config.settings.autobackup.backupinvervalhours * 60 * 60 * 1000);
|
||||
if (obj.config.settings.autobackup && (typeof obj.config.settings.autobackup.backupintervalhours == 'number')) {
|
||||
setInterval(obj.db.performBackup, obj.config.settings.autobackup.backupintervalhours * 60 * 60 * 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -3,6 +3,7 @@
|
||||
"settings": {
|
||||
"_Cert": "myserver.mydomain.com",
|
||||
"_MongoDb": "mongodb://127.0.0.1:27017/meshcentral",
|
||||
"_MongoDbChangeStream": true,
|
||||
"_WANonly": true,
|
||||
"_LANonly": true,
|
||||
"_Minify": 1,
|
||||
@ -41,7 +42,7 @@
|
||||
]
|
||||
},
|
||||
"_AutoBackup": {
|
||||
"backupInvervalHours": 24,
|
||||
"backupIntervalHours": 24,
|
||||
"keepLastDaysBackup": 10,
|
||||
"zipPassword": "MyReallySecretPassword3",
|
||||
"_backupPath": "C:\\backups"
|
||||
|
Loading…
Reference in New Issue
Block a user