mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added command line options to pull/push/read/delete config files in the db.
This commit is contained in:
parent
f7be945aef
commit
6cc21f5709
4 changed files with 70 additions and 5 deletions
9
db.js
9
db.js
|
@ -176,6 +176,15 @@ module.exports.CreateDB = function (parent) {
|
|||
obj.getLocalAmtNodes = function (func) { obj.file.find({ type: 'node', host: { $exists: true, $ne: null }, intelamt: { $exists: true } }, func); };
|
||||
obj.getAmtUuidNode = function (meshid, uuid, func) { obj.file.find({ type: 'node', meshid: meshid, 'intelamt.uuid': uuid }, func); };
|
||||
|
||||
// Read a file from the database
|
||||
obj.getFile = function (path, func) { obj.Get('cfile/' + path, func); }
|
||||
|
||||
// Write a file to the database
|
||||
obj.setFile = function (path, data, func) { obj.Set({ _id: 'cfile/' + path, type: 'cfile', data: data.toString('base64') }, func); }
|
||||
|
||||
// List all files
|
||||
obj.listFiles = function (func) { obj.file.find({ type: 'cfile' }).sort({ _id: 1 }).exec(func); }
|
||||
|
||||
// Get the number of records in the database for various types, this is the slow NeDB way. TODO: MongoDB can use group() to do this faster.
|
||||
obj.getStats = function (func) {
|
||||
obj.file.count({ type: 'node' }, function (err, nodeCount) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue