use new nedb instead of old

This commit is contained in:
Simon Smith 2023-09-07 19:31:26 +01:00 committed by GitHub
parent b1d2d1aea9
commit 7ea744fdfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

5
db.js
View File

@ -3181,7 +3181,10 @@ module.exports.CreateDB = function (parent, func) {
// Transfer NeDB data into the current database
obj.nedbtodb = function (func) {
var nedbDatastore = require('nedb');
var nedbDatastore = null;
try { nedbDatastore = require('@yetzt/nedb'); } catch (ex) { } // This is the NeDB with fixed security dependencies.
if (nedbDatastore == null) { nedbDatastore = require('nedb'); } // So not to break any existing installations, if the old NeDB is present, use it.
var datastoreOptions = { filename: parent.getConfigFilePath('meshcentral.db'), autoload: true };
// If a DB encryption key is provided, perform database encryption