1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed usernames that include a dot (.)

This commit is contained in:
Ylian Saint-Hilaire 2018-07-13 19:18:43 -07:00
parent 5949c7456c
commit 81ccbae15c
16 changed files with 139 additions and 91 deletions

11
db.js
View file

@ -17,24 +17,25 @@
// Just run with --mongodb [connectionstring], where the connection string is documented here: https://docs.mongodb.com/manual/reference/connection-string/
// The default collection is "meshcentral", but you can override it using --mongodbcol [collection]
//
module.exports.CreateDB = function (args, datapath) {
module.exports.CreateDB = function (parent) {
var obj = {};
obj.path = require('path');
obj.parent = parent;
obj.identifier = null;
if (args.mongodb) {
if (obj.parent.args.mongodb) {
// Use MongoDB
obj.databaseType = 2;
var Datastore = require('mongojs');
var db = Datastore(args.mongodb);
var db = Datastore(obj.parent.args.mongodb);
var dbcollection = 'meshcentral';
if (args.mongodbcol) { dbcollection = args.mongodbcol; }
if (obj.parent.args.mongodbcol) { dbcollection = obj.parent.args.mongodbcol; }
obj.file = db.collection(dbcollection);
} else {
// Use NeDB (The default)
obj.databaseType = 1;
var Datastore = require('nedb');
obj.file = new Datastore({ filename: obj.path.join(datapath, 'meshcentral.db'), autoload: true });
obj.file = new Datastore({ filename: obj.parent.getConfigFilePath('meshcentral.db'), autoload: true });
obj.file.persistence.setAutocompactionInterval(3600);
}