Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(NODE-4136): adjust Node.js bindings for shared library spec #306

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

addaleax
Copy link
Contributor

@addaleax addaleax commented Apr 19, 2022

Specifically, pass a default csfleSearchPaths list of ['$SYSTEM'],
and add support for csfleRequired.

As drive-by fixes, fix a typo that currently (unintentionally) leads to
_mongocryptdClient and _mongocryptdManager being initialized even
if bypassAutoEncryption was specified, and adjust the tests and the
.teardown() method for those cases.

Typings changes: mongodb/node-mongodb-native#3206

Specifically, pass a default `csfleSearchPaths` list of `['$SYSTEM']`,
and add support for `csfleRequired`.

As drive-by fixes, fix a typo that currently (unintentionally) leads to
`_mongocryptdClient` and `_mongocryptdManager` being initialized even
if `bypassAutoEncryption` was specified, and adjust the tests and the
`.teardown()` method for those cases.
// Only instantiate mongocryptd manager/client once we know for sure
// that we are not using the CSFLE shared library.
if (!this._bypassAutoEncryption && !this.csfleVersionInfo) {
if (!this._bypassEncryption && !this.csfleVersionInfo) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn’t realize in efad8b6 that this condition (before the addition of csfleVersionInfo) would never actually have been hit due to the typo.

Obviously it would be possible to go the other way here as well, i.e. drop the conditional entirely and always create _mongocryptdManager and _mongocryptdClient. Let me know if you have a specific preference 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to not have the cryptdManager exist when we are using the lib. Good catch!

// Only instantiate mongocryptd manager/client once we know for sure
// that we are not using the CSFLE shared library.
if (!this._bypassAutoEncryption && !this.csfleVersionInfo) {
if (!this._bypassEncryption && !this.csfleVersionInfo) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to not have the cryptdManager exist when we are using the lib. Good catch!

Copy link
Member

@durran durran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@durran durran merged commit d3f3884 into mongodb:master Apr 21, 2022
@addaleax addaleax deleted the node-4136-dev branch April 21, 2022 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants