Skip to content

Commit

Permalink
fix(NODE-4254): allow csfle to be dynamically required (#3260)
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed May 24, 2022
1 parent 4b9ad77 commit cd6b5a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .evergreen/config.yml
Expand Up @@ -1630,7 +1630,7 @@ tasks:
- func: bootstrap mongo-orchestration
vars:
VERSION: latest
TOPOLOGY: server
TOPOLOGY: replica_set
- func: bootstrap kms servers
- func: run custom csfle tests
- name: test-latest-server-noauth
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/generate_evergreen_tasks.js
Expand Up @@ -512,7 +512,7 @@ oneOffFuncAsTasks.push({
func: 'bootstrap mongo-orchestration',
vars: {
VERSION: 'latest',
TOPOLOGY: 'server'
TOPOLOGY: 'replica_set'
}
},
{ func: 'bootstrap kms servers' },
Expand Down
10 changes: 8 additions & 2 deletions src/encrypter.ts
Expand Up @@ -124,9 +124,15 @@ export class Encrypter {

static checkForMongoCrypt(): void {
let mongodbClientEncryption = undefined;
// Ensure you always wrap an optional require in the try block NODE-3199
try {
// Ensure you always wrap an optional require in the try block NODE-3199
mongodbClientEncryption = require('mongodb-client-encryption');
// Note (NODE-4254): This is to get around the circular dependency between
// mongodb-client-encryption and the driver in the test scenarios.
if (process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE) {
mongodbClientEncryption = require(process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE);
} else {
mongodbClientEncryption = require('mongodb-client-encryption');
}
} catch (err) {
throw new MongoMissingDependencyError(
'Auto-encryption requested, but the module is not installed. ' +
Expand Down

0 comments on commit cd6b5a0

Please sign in to comment.