File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed
Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import ConnectionString from 'mongodb-connection-string-url';
1313import { EventEmitter } from 'events' ;
1414import type { MongoClientOptions } from 'mongodb' ;
1515import { v4 as uuidv4 } from 'uuid' ;
16-
16+ import { createKeytar } from './utils/keytar' ;
1717import { CONNECTION_STATUS } from './views/webview-app/extension-app-message-constants' ;
1818import { createLogger } from './logging' ;
1919import { ext } from './extensionConstants' ;
@@ -296,6 +296,13 @@ export default class ConnectionController {
296296 async _migrateConnectionWithKeytarSecrets (
297297 savedConnectionInfo : StoreConnectionInfoWithConnectionOptions
298298 ) : Promise < MigratedStoreConnectionInfoWithConnectionOptions | undefined > {
299+ try {
300+ ext . keytarModule =
301+ ext . keytarModule === undefined ? createKeytar ( ) : ext . keytarModule ;
302+ } catch ( err ) {
303+ // Couldn't load keytar, proceed without storing & loading connections.
304+ }
305+
299306 // If the Keytar module is not available, we simply mark the connections
300307 // storage as Keytar and return
301308 if ( ! ext . keytarModule ) {
Original file line number Diff line number Diff line change 33import * as vscode from 'vscode' ;
44
55import { ext } from './extensionConstants' ;
6- import { createKeytar } from './utils/keytar' ;
76import { createLogger } from './logging' ;
87// eslint-disable-next-line @typescript-eslint/no-var-requires
98const { version } = require ( '../package.json' ) ;
@@ -30,14 +29,6 @@ export async function activate(
3029 context : vscode . ExtensionContext
3130) : Promise < void > {
3231 ext . context = context ;
33- let hasKeytar = false ;
34-
35- try {
36- ext . keytarModule = createKeytar ( ) ;
37- hasKeytar = true ;
38- } catch ( err ) {
39- // Couldn't load keytar, proceed without storing & loading connections.
40- }
4132
4233 const defaultConnectionSavingLocation = vscode . workspace
4334 . getConfiguration ( 'mdb.connectionSaving' )
@@ -53,7 +44,6 @@ export async function activate(
5344 workspaceStoragePath : context . storageUri ?. path ,
5445 globalStoragePath : context . globalStorageUri . path ,
5546 defaultConnectionSavingLocation,
56- hasKeytar,
5747 buildInfo : {
5848 nodeVersion : process . version ,
5949 runtimePlatform : process . platform ,
You can’t perform that action at this time.
0 commit comments