-
Notifications
You must be signed in to change notification settings - Fork 5
WIP [do not review]: Simplify connecting, fix double authSource #348
base: master
Are you sure you want to change the base?
Conversation
@@ -16,10 +16,7 @@ try { | |||
basepath = electron.remote | |||
? electron.remote.app.getPath('userData') | |||
: undefined; | |||
} catch (e) { | |||
/* eslint no-console: 0 */ | |||
console.log('Could not load electron', e.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would sometimes show up in vscode, here we make it less noisy.
|
||
const debug = require('debug')('mongodb-connection-model:connect'); | ||
|
||
const needToLoadSSLFiles = (model) => | ||
!includes(['NONE', 'UNVALIDATED'], model.sslType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sslType
doesn't seem to exist on connection-model, so this false condition would never occur. Probably a bug, removed it and updated how we load the ssl files into buffers.
if (includes(['LDAP', 'KERBEROS', 'X509'], this.authStrategy)) { | ||
if ( | ||
includes(['LDAP', 'KERBEROS', 'X509'], this.authStrategy) | ||
&& !url.includes('authSource=') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would sometimes apply authSource=$external
twice to connection strings. Maybe a bug? Some of the tests had test cases with the duplicate authSource=$external
. Not sure if intentional. I think it would probably be better to be using the url package for managing this url and not doing straight string editing. not going to get into that in this pr I think.
This PR does some refactoring of connect so it uses async/await (see data-service and compass-connect PRs). Removed some unused code. Updated tests and improved them a bit.
Originally I was looking into fixing how we load ssl files into buffers so that we just pass the files into buffers. It ended up having some more nuances with the driver than I expected so I'm opening this PR first, without any large ssl changes, and I'm thinking we can address it separately in COMPASS-4615 . In 4.0.0 the driver also drops support for buffers, and hopefully it's doing a little less behind the scenes there.