From c1109b7a32ec60cef64f98fa9e20982ee5d93508 Mon Sep 17 00:00:00 2001 From: Nir Levy Date: Sun, 23 Apr 2023 17:59:01 +0300 Subject: [PATCH] Add option to override AWS profile by setting --- package.json | 5 +++++ src/connectionController.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/package.json b/package.json index c015c9083..3c681c41c 100644 --- a/package.json +++ b/package.json @@ -954,6 +954,11 @@ "type": "boolean", "default": false, "description": "The default behavior is to generate a single ObjectId and insert it on all cursors. Set to true to generate a unique ObjectId per cursor instead." + }, + "mdb.AWSProfile": { + "type": "string", + "default": "default", + "description": "The AWS Profile to set. This will allow MONGODB-AWS authentication using a set profile." } } } diff --git a/src/connectionController.ts b/src/connectionController.ts index 2c1c195e5..21370ba95 100644 --- a/src/connectionController.ts +++ b/src/connectionController.ts @@ -437,6 +437,13 @@ export default class ConnectionController { this._statusView.showMessage('Connecting to MongoDB...'); + const awsProfile: string | undefined = vscode.workspace + .getConfiguration('mdb') + .get('AWSProfile'); + this._statusView.showMessage(`Using AWS Profile ${awsProfile}`); + process.env.AWS_PROFILE = awsProfile; + + const connectionOptions = this._connections[connectionId].connectionOptions; if (!connectionOptions) {