Skip to content

Commit

Permalink
chore(compass): log debug information about SafeStorage environment (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax authored Apr 4, 2024
1 parent ecec8df commit 21e6c9c
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions packages/compass/src/main/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,26 @@ class CompassApplication {
return;
}

const enablePlainTextEncryption =
process.env.MONGODB_COMPASS_TEST_USE_PLAIN_SAFE_STORAGE === 'true';
if (enablePlainTextEncryption) {
// When testing we want to use plain text encryption to avoid having to
// deal with keychain popups or setting up keychain for test on CI (Linux env).
// This method is only available on Linux and is no-op on other platforms.
safeStorage.setUsePlainTextEncryption(true);
}

log.info(
mongoLogId(1_001_000_307),
'Application',
'SafeStorage initialized',
{
enablePlainTextEncryption,
isAvailable: safeStorage.isEncryptionAvailable(),
backend: safeStorage.getSelectedStorageBackend?.(),
}
);

// ConnectionStorage offers import/export which is used via CLI as well.
ConnectionStorage.init();

Expand All @@ -102,13 +122,6 @@ class CompassApplication {
);
}

if (process.env.MONGODB_COMPASS_TEST_USE_PLAIN_SAFE_STORAGE === 'true') {
// When testing we want to use plain text encryption to avoid having to
// deal with keychain popups or setting up keychain for test on CI (Linux env).
// This method is only available on Linux and is no-op on other platforms.
safeStorage.setUsePlainTextEncryption(true);
}

if (mode === 'CLI') {
return;
}
Expand Down

0 comments on commit 21e6c9c

Please sign in to comment.