Skip to content

Commit 49432f8

Browse files
authored
Merge pull request #3260 from Countly/revert-3225-fix/mongodb-options
Revert "Fix/mongodb options"
2 parents 7068590 + b8df633 commit 49432f8

File tree

10 files changed

+74
-138
lines changed

10 files changed

+74
-138
lines changed

api/configextender.js

+2-78
Original file line numberDiff line numberDiff line change
@@ -26,81 +26,8 @@ const OVERRIDES = {
2626
REPLSETSERVERS: 'replSetServers',
2727
REPLICANAME: 'replicaName',
2828
MAX_POOL_SIZE: 'max_pool_size',
29-
DBOPTIONS: {
30-
__name: "dbOptions",
31-
AUTHMECHANISM: 'authMechanism',
32-
AUTHMECHANISMPROPERTIES: 'authMechanismProperties',
33-
AUTHSOURCE: 'authSource',
34-
AUTOENCRYPTION: 'autoEncryption',
35-
BSONREGEXP: 'bsonRegExp',
36-
CHECKKEYS: 'checkKeys',
37-
CHECKSERVERIDENTITY: 'checkServerIdentity',
38-
CONNECTTIMEOUTMS: 'connectTimeoutMS',
39-
DIRECTCONNECTION: 'directConnection',
40-
DRIVERINFO: 'driverInfo',
41-
ECDHCURVE: 'ecdhCurve',
42-
ENABLEUTF8VALIDATION: 'enableUtf8Validation',
43-
FIELDSASRAW: 'fieldsAsRaw',
44-
FORCESERVEROBJECTID: 'forceServerObjectId',
45-
HEARTBEATFREQUENCYMS: 'heartbeatFrequencyMS',
46-
IGNOREUNDEFINED: 'ignoreUndefined',
47-
KEEPALIVE: 'keepAlive',
48-
KEEPALIVEINITIALDELAY: 'keepAliveInitialDelay',
49-
LOADBALANCED: 'loadBalanced',
50-
LOCALADDRESS: 'localAddress',
51-
LOCALPORT: 'localPort',
52-
LOCALTHRESHOLDMS: 'localThresholdMS',
53-
LOGGERLEVEL: 'loggerLevel',
54-
MAXIDLETIMEMS: 'maxIdleTimeMS',
55-
MAXPOOLSIZE: 'maxPoolSize',
56-
MAXSTALENESSSECONDS: 'maxStalenessSeconds',
57-
MINDHSIZE: 'minDHSize',
58-
MINHEARTBEATFREQUENCYMS: 'minHeartbeatFrequencyMS',
59-
MINPOOLSIZE: 'minPoolSize',
60-
MONITORCOMMANDS: 'monitorCommands',
61-
NODELAY: 'noDelay',
62-
PKFACTORY: 'pkFactory',
63-
PROMISELIBRARY: 'promiseLibrary',
64-
PROMOTEBUFFERS: 'promoteBuffers',
65-
PROMOTELONGS: 'promoteLongs',
66-
PROMOTEVALUES: 'promoteValues',
67-
PROXYHOST: 'proxyHost',
68-
PROXYPASSWORD: 'proxyPassword',
69-
PROXYPORT: 'proxyPort',
70-
PROXYUSERNAME: 'proxyUsername',
71-
READCONCERN: 'readConcern',
72-
READCONCERNLEVEL: 'readConcernLevel',
73-
READPREFERENCE: 'readPreference',
74-
READPREFERENCETAGS: 'readPreferenceTags',
75-
REJECTUNAUTHORIZED: 'rejectUnauthorized',
76-
REPLICASET: 'replicaSet',
77-
RETRYREADS: 'retryReads',
78-
RETRYWRITES: 'retryWrites',
79-
SECURECONTEXT: 'secureContext',
80-
SECUREPROTOCOL: 'secureProtocol',
81-
SERIALIZEFUNCTIONS: 'serializeFunctions',
82-
SERVERAPI: 'serverApi',
83-
SERVERSELECTIONTIMEOUTMS: 'serverSelectionTimeoutMS',
84-
SOCKETTIMEOUTMS: 'socketTimeoutMS',
85-
SRVMAXHOSTS: 'srvMaxHosts',
86-
SRVSERVICENAME: 'srvServiceName',
87-
SSLCA: 'sslCA',
88-
SSLCRL: 'sslCRL',
89-
SSLCERT: 'sslCert',
90-
SSLKEY: 'sslKey',
91-
SSLPASS: 'sslPass',
92-
SSLVALIDATE: 'sslValidate',
93-
TLSALLOWINVALIDCERTIFICATES: 'tlsAllowInvalidCertificates',
94-
TLSALLOWINVALIDHOSTNAMES: 'tlsAllowInvalidHostnames',
95-
TLSCAFILE: 'tlsCAFile',
96-
TLSCERTIFICATEFILE: 'tlsCertificateFile',
97-
TLSCERTIFICATEKEYFILE: 'tlsCertificateKeyFile',
98-
TLSCERTIFICATEKEYFILEPASSWORD: 'tlsCertificateKeyFilePassword',
99-
TLSINSECURE: 'tlsInsecure',
100-
WAITQUEUETIMEOUTMS: 'waitQueueTimeoutMS',
101-
WTIMEOUTMS: 'wtimeoutMS',
102-
ZLIBCOMPRESSIONLEVEL: 'zlibCompressionLevel',
103-
},
29+
DBOPTIONS: 'dbOptions',
30+
SERVEROPTIONS: 'serverOptions'
10431
},
10532

10633
API: {
@@ -139,9 +66,6 @@ function dig(config, over, name, value) {
13966
sub = over[n];
14067
over[n] = {};
14168
}
142-
else if (over[n] && over[n].__name) {
143-
sub = over[n].__name;
144-
}
14569
else {
14670
sub = Object.keys(config).filter(k => k.toUpperCase() === n)[0];
14771
}

frontend/express/public/themes/rtl/theme.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
.cly-vue-nps-preview .rating-labels .left { float: right !important; }
1010
.cly-vue-nps-preview .rating-labels .right { float: left !important; }
1111
.cly-vue-nps-preview .submit-wrapper .submit-button { float: left !important; }
12-
.cly-vue-nps-preview .submit-wrapper img { float: right !important; }
12+
.cly-vue-nps-preview .submit-wrapper img { float: right !important; }
13+
.cly-vue-ratings-preview { direction: rtl; }

package-lock.json

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"apidoc": "0.51.1",
3232
"apidoc-template": "github:kanwarujjaval/dash-apidoc-template",
3333
"argon2": "0.28.5",
34-
"async": "3.2.3",
34+
"async": "3.2.4",
3535
"basic-auth": "2.0.1",
3636
"bluebird": "3.7.2",
3737
"body-parser": "1.20.0",
@@ -73,7 +73,7 @@
7373
"method-override": "3.0.0",
7474
"moment": "2.29.3",
7575
"moment-timezone": "0.5.34",
76-
"mongodb": "4.6.0",
76+
"mongodb": "4.7.0",
7777
"nginx-conf": "1.5.0",
7878
"node-xlsx-stream": "0.1.8",
7979
"nodemailer": "6.7.5",
@@ -83,10 +83,10 @@
8383
"object-hash": "3.0.0",
8484
"offline-geocoder": "github:iartem/offline-geocoder",
8585
"properties-parser": "0.3.1",
86-
"puppeteer": "14.2.1",
86+
"puppeteer": "14.3.0",
8787
"request": "2.88.2",
88-
"sass": "1.52.2",
89-
"uglify-js": "3.15.5",
88+
"sass": "1.52.3",
89+
"uglify-js": "3.16.0",
9090
"underscore": "1.13.4",
9191
"yamljs": "0.3.0"
9292
},

plugins/pluginManager.js

+28-26
Original file line numberDiff line numberDiff line change
@@ -1078,12 +1078,8 @@ var pluginManager = function pluginManager() {
10781078
config = config || JSON.parse(JSON.stringify(countlyConfig));
10791079
}
10801080

1081-
if (config && typeof config.mongodb === "string") {
1082-
config.mongodb = {uri: config.mongodb};
1083-
}
1084-
1085-
if (config.mongodb.uri) {
1086-
var dbName = this.replaceDatabaseString(config.mongodb.uri, db);
1081+
if (typeof config.mongodb === 'string') {
1082+
var dbName = this.replaceDatabaseString(config.mongodb, db);
10871083
//remove protocol
10881084
dbName = dbName.split("://").pop();
10891085
if (dbName.indexOf("@") !== -1) {
@@ -1102,11 +1098,17 @@ var pluginManager = function pluginManager() {
11021098
var qstring = parts[1];
11031099
if (qstring && qstring.length) {
11041100
qstring = querystring.parse(qstring);
1105-
if (qstring.ssl) {
1101+
if (qstring.ssl && (qstring.ssl === true || qstring.ssl === "true")) {
11061102
ob.ssl = "";
11071103
ob.sslAllowInvalidCertificates = "";
11081104
ob.sslAllowInvalidHostnames = "";
11091105
}
1106+
if (qstring.tls && (qstring.tls === true || qstring.tls === "true")) {
1107+
ob.tls = "";
1108+
ob.tlsAllowInvalidCertificates = "";
1109+
ob.tlsAllowInvalidHostnames = "";
1110+
ob.tlsInsecure = "";
1111+
}
11101112
if (qstring.replicaSet) {
11111113
ob.host = qstring.replicaSet + "/" + ob.host;
11121114
}
@@ -1129,11 +1131,17 @@ var pluginManager = function pluginManager() {
11291131
else {
11301132
ob.host = (config.mongodb.host + ':' + config.mongodb.port);
11311133
}
1132-
if (config.mongodb.serverOptions && config.mongodb.serverOptions.ssl) {
1134+
if (config.mongodb.serverOptions && config.mongodb.serverOptions.ssl && (config.mongodb.serverOptions.ssl === true || config.mongodb.serverOptions.ssl === "true")) {
11331135
ob.ssl = "";
11341136
ob.sslAllowInvalidCertificates = "";
11351137
ob.sslAllowInvalidHostnames = "";
11361138
}
1139+
if (config.mongodb.serverOptions && config.mongodb.serverOptions.tls && (config.mongodb.serverOptions.tls === true || config.mongodb.serverOptions.tls === "true")) {
1140+
ob.tls = "";
1141+
ob.tlsAllowInvalidCertificates = "";
1142+
ob.tlsAllowInvalidHostnames = "";
1143+
ob.tlsInsecure = "";
1144+
}
11371145
if (config.mongodb.username && config.mongodb.password) {
11381146
ob.username = config.mongodb.username;
11391147
ob.password = utils.decrypt(config.mongodb.password);
@@ -1156,13 +1164,12 @@ var pluginManager = function pluginManager() {
11561164
* @returns {string} modified connection string
11571165
**/
11581166
this.replaceDatabaseString = function(str, db) {
1159-
var parts = str.split("?");
1160-
var i = parts[0].lastIndexOf('/countly');
1161-
var k = parts[0].lastIndexOf('/' + db);
1167+
var i = str.lastIndexOf('/countly');
1168+
var k = str.lastIndexOf('/' + db);
11621169
if (i !== k && i !== -1 && db) {
1163-
return parts[0].substr(0, i) + "/" + db + parts[0].substr(i + ('/countly').length);
1170+
return str.substr(0, i) + "/" + db + str.substr(i + ('/countly').length);
11641171
}
1165-
return parts.join("?");
1172+
return str;
11661173
};
11671174

11681175
this.connectToAllDatabases = async() => {
@@ -1222,11 +1229,7 @@ var pluginManager = function pluginManager() {
12221229
}
12231230

12241231
if (config && typeof config.mongodb === "string") {
1225-
config.mongodb = {uri: config.mongodb};
1226-
}
1227-
1228-
if (config.mongodb.uri) {
1229-
var urlParts = url.parse(config.mongodb.uri, true);
1232+
var urlParts = url.parse(config.mongodb, true);
12301233
if (urlParts && urlParts.query && urlParts.query.maxPoolSize) {
12311234
maxPoolSize = urlParts.query.maxPoolSize;
12321235
}
@@ -1249,8 +1252,8 @@ var pluginManager = function pluginManager() {
12491252
useNewUrlParser: true,
12501253
useUnifiedTopology: true
12511254
};
1252-
if (config.mongodb.uri) {
1253-
dbName = this.replaceDatabaseString(config.mongodb.uri, db);
1255+
if (typeof config.mongodb === 'string') {
1256+
dbName = this.replaceDatabaseString(config.mongodb, db);
12541257
}
12551258
else {
12561259
config.mongodb.db = db || config.mongodb.db || 'countly';
@@ -1275,15 +1278,9 @@ var pluginManager = function pluginManager() {
12751278
}
12761279

12771280
if (config.mongodb.username && config.mongodb.password) {
1278-
dbName = dbName.replace('mongodb://', '').replace('mongodb+srv://', '');
12791281
dbName = encodeURIComponent(config.mongodb.username) + ":" + encodeURIComponent(utils.decrypt(config.mongodb.password)) + "@" + dbName;
12801282
}
12811283

1282-
if (config.mongodb.username) {
1283-
dbName = dbName.replace('mongodb://', '').replace('mongodb+srv://', '');
1284-
dbName = encodeURIComponent(config.mongodb.username) + "@" + dbName;
1285-
}
1286-
12871284
if (dbName.indexOf('mongodb://') !== 0 && dbName.indexOf('mongodb+srv://') !== 0) {
12881285
dbName = 'mongodb://' + dbName;
12891286
}
@@ -1322,6 +1319,11 @@ var pluginManager = function pluginManager() {
13221319
}
13231320
catch (ex) {
13241321
logDbRead.e("Error connecting to database", ex);
1322+
logDbRead.e("With params %j", {
1323+
db: db_name,
1324+
connection: dbName,
1325+
options: dbOptions
1326+
});
13251327
//exit to retry to reconnect on restart
13261328
process.exit(1);
13271329
return;

plugins/push/package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/push/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"dependencies": {
2323
"jsonwebtoken": "8.0.1",
2424
"node-forge": "1.3.1",
25-
"xxhash-addon": "1.4.0"
25+
"xxhash-addon": "1.5.0"
2626
},
2727
"private": true
2828
}

plugins/star-rating/frontend/public/templates/drawer.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
v-bind="$props.controls">
1515
<template v-slot:sidecars="drawerScope">
1616
<cly-content id="mainSidecar" role="sidecar" :always-active="true">
17-
<div class="ratings-drawer__sidecar widget-preview">
17+
<div class="ratings-drawer__sidecar widget-preview cly-vue-ratings-preview">
1818
<div class="preview-stage" v-if="drawerScope.currentStepId === 'step1' || drawerScope.currentStepId === 'step2' || drawerScope.currentStepId === 'step3'" >
1919
<div class="bu-is-size-7 ratings-drawer__stage-label">
2020
{{ i18n('feedback.ratings-popup') }}

plugins/star-rating/frontend/public/templates/feedback-popup.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<meta content="width=device-width, initial-scale=1" name="viewport">
1616
</meta>
1717
</head>
18-
<body class="ratings-popup">
18+
<body class="ratings-popup cly-vue-ratings-preview">
1919
<div class="rating-loader-wrapper">
2020
<img src="../../star-rating/images/star-rating/loader.svg" class="rating-loader"/>
2121
</div>

0 commit comments

Comments
 (0)