From 161e999e016f34945184e8805a31f9ce50109b0a Mon Sep 17 00:00:00 2001 From: Lokesh Goel Date: Wed, 31 Jan 2024 23:16:09 +0530 Subject: [PATCH] use dotenv to load lambda secrets --- .github/workflows/ci.yml | 3 +++ package-lock.json | 12 ++++++++++++ package.json | 1 + src/util/secretUpdater.ts | 10 ++++++++-- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index baa1fab0..3be0b887 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - shell: pwsh + env: + FEEDBACK_LAMBDA_SECRET: ${{ secrets.FEEDBACK_LAMBDA_SECRET }} + FEEDBACK_LAMBDA_URL: ${{ secrets.FEEDBACK_LAMBDA_URL }} run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/package-lock.json b/package-lock.json index 24336385..b2cb5226 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,7 @@ "d3-zoom": "^1.8.3", "dayjs": "^1.11.9", "decompress": "^4.2.1", + "dotenv": "^16.4.1", "gitly": "^2.4.2", "keytar": "^7.7.0", "monaco-editor": "^0.43.0", @@ -5524,6 +5525,17 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/dotenv": { + "version": "16.4.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz", + "integrity": "sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/duplexer2": { "version": "0.1.4", "dev": true, diff --git a/package.json b/package.json index 23359ba6..c726bb45 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,7 @@ "d3-zoom": "^1.8.3", "dayjs": "^1.11.9", "decompress": "^4.2.1", + "dotenv": "^16.4.1", "gitly": "^2.4.2", "keytar": "^7.7.0", "monaco-editor": "^0.43.0", diff --git a/src/util/secretUpdater.ts b/src/util/secretUpdater.ts index 9033fa29..2e2c5e6a 100644 --- a/src/util/secretUpdater.ts +++ b/src/util/secretUpdater.ts @@ -1,7 +1,13 @@ import { ExtensionContext } from "vscode"; +import * as dotenv from 'dotenv'; // Before Building, Please update secrets else IQ Feedback service will not work export const secretUpdater = (context: ExtensionContext) => { - context.globalState.update("feedbackLambdaSecret", "c0uchbase_is_aw3some"); - context.globalState.update("feedbackLambdaUrl", "https://nms548yy5b.execute-api.us-west-1.amazonaws.com/Prod/"); + dotenv.config(); + console.log(process.env); + console.log("secret: ", process.env.FEEDBACK_LAMBDA_SECRET); + console.log("url: ", process.env.FEEDBACK_LAMBDA_URL); + + context.globalState.update("feedbackLambdaSecret", process.env.FEEDBACK_LAMBDA_SECRET); + context.globalState.update("feedbackLambdaUrl", process.env.FEEDBACK_LAMBDA_URL); }; \ No newline at end of file