Skip to content
This repository was archived by the owner on May 31, 2022. It is now read-only.

WIP [do not review]: Simplify connecting, fix double authSource #348

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Feb 9, 2021

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.

  • Is it possible that a user would have multiple ssl files in one field? This PR is changing that behavior so that we no longer parse multiple items in the file array, and take just the first entry in those instances.

@@ -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);
Copy link
Member Author

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);
Copy link
Member Author

@Anemy Anemy Feb 9, 2021

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=')
Copy link
Member Author

@Anemy Anemy Feb 9, 2021

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.

@Anemy Anemy changed the title WIP - Simplify connecting, pass ssl file locations instead of buffers to driver WIP - Simplify connecting, fix double authSource Feb 9, 2021
@Anemy Anemy changed the title WIP - Simplify connecting, fix double authSource chore: Simplify connecting, fix double authSource Feb 9, 2021
@Anemy Anemy closed this Feb 9, 2021
@Anemy Anemy reopened this Feb 9, 2021
@Anemy Anemy changed the title chore: Simplify connecting, fix double authSource WIP [do not review]: Simplify connecting, fix double authSource Feb 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy