@itentialopensource/adapter-utils 5.10.13 → 5.10.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dbUtil.js +11 -9
- package/package.json +2 -2
package/lib/dbUtil.js
CHANGED
|
@@ -595,10 +595,11 @@ class DBUtil {
|
|
|
595
595
|
*/
|
|
596
596
|
determineStorage(dbInfo, callback) {
|
|
597
597
|
const origin = `${this.myid}-dbUtil-determineStorage`;
|
|
598
|
+
|
|
598
599
|
if (dbInfo) {
|
|
599
600
|
// priority 1 - use the dbInfo passed in
|
|
600
601
|
if (dbInfo.dburl && dbInfo.database) {
|
|
601
|
-
MongoClient.connect(dbInfo.dburl, dbInfo.dboptions, (err, mongoClient) => {
|
|
602
|
+
return MongoClient.connect(dbInfo.dburl, dbInfo.dboptions, (err, mongoClient) => {
|
|
602
603
|
if (err) {
|
|
603
604
|
log.error(`${origin}: Error! Failed to connect to database: ${err}`);
|
|
604
605
|
return callback(err, null, null, null);
|
|
@@ -606,19 +607,20 @@ class DBUtil {
|
|
|
606
607
|
log.debug('using dbinfo');
|
|
607
608
|
return callback(null, Storage.DBINFO, mongoClient, dbInfo.database);
|
|
608
609
|
});
|
|
609
|
-
} else {
|
|
610
|
-
const err = 'Error! Marlformed dbInfo';
|
|
611
|
-
return callback(err, null, null, Storage.DBINFO);
|
|
612
610
|
}
|
|
613
|
-
|
|
611
|
+
const err = 'Error! Malformed dbInfo - require url and database';
|
|
612
|
+
return callback(err, null, null, Storage.DBINFO);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (this.adapterMongoClient) {
|
|
614
616
|
// priority 2 - use the adapter database
|
|
615
617
|
log.debug('using adapter db');
|
|
616
618
|
return callback(null, Storage.ADAPTERDB, this.adapterMongoClient, this.database);
|
|
617
|
-
} else if (this.dburl === null && dbInfo === null) {
|
|
618
|
-
// priority 3 - use the filesystem
|
|
619
|
-
log.debug('using filesystem');
|
|
620
|
-
return callback(null, Storage.FILESYSTEM, null, null);
|
|
621
619
|
}
|
|
620
|
+
|
|
621
|
+
// priority 3 - use the filesystem
|
|
622
|
+
log.debug('using filesystem');
|
|
623
|
+
return callback(null, Storage.FILESYSTEM, null, null);
|
|
622
624
|
}
|
|
623
625
|
|
|
624
626
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-utils",
|
|
3
|
-
"version": "5.10.
|
|
3
|
+
"version": "5.10.15",
|
|
4
4
|
"description": "Itential Adapter Utility Libraries",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node utils/setup.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"jsontoxml": "^1.0.1",
|
|
39
39
|
"jsonwebtoken": "^9.0.1",
|
|
40
40
|
"mongodb": "^3.7.4",
|
|
41
|
+
"mocha": "^10.7.3",
|
|
41
42
|
"readline-sync": "^1.4.10",
|
|
42
43
|
"socks-proxy-agent": "^8.0.1",
|
|
43
44
|
"uuid": "^9.0.0",
|
|
@@ -49,7 +50,6 @@
|
|
|
49
50
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
50
51
|
"eslint-plugin-import": "^2.27.5",
|
|
51
52
|
"eslint-plugin-json": "^3.1.0",
|
|
52
|
-
"mocha": "^10.7.3",
|
|
53
53
|
"nock": "^13.3.1",
|
|
54
54
|
"strip-ansi": "^7.1.0",
|
|
55
55
|
"strip-ansi-cli": "^3.0.2",
|