From 2f90d2e8b51b7e3fd31853d711d16d5203c52045 Mon Sep 17 00:00:00 2001 From: Ilona Shishov Date: Mon, 2 Oct 2023 14:32:33 +0300 Subject: [PATCH] feat: add RHDA_KEY param to Exhort JS API request Signed-off-by: Ilona Shishov --- package-lock.json | 6 +++--- src/config.ts | 2 ++ src/server.ts | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index d74ee517..f136cef7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4293,9 +4293,9 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, "engines": { "node": "*" diff --git a/src/config.ts b/src/config.ts index 650d5e90..d743be02 100644 --- a/src/config.ts +++ b/src/config.ts @@ -17,6 +17,7 @@ class Config npm_executable: string; go_executable: string; exhort_dev_mode: string; + telemetry_id: string; constructor() { // TODO: this needs to be configurable @@ -30,6 +31,7 @@ class Config this.npm_executable = process.env.NPM_EXECUTABLE || 'npm'; this.go_executable = process.env.GO_EXECUTABLE || 'go'; this.exhort_dev_mode = process.env.EXHORT_DEV_MODE || 'false'; + this.telemetry_id = process.env.TELEMETRY_ID || ''; } } diff --git a/src/server.ts b/src/server.ts index c3e6fbb5..7f01b124 100644 --- a/src/server.ts +++ b/src/server.ts @@ -5,7 +5,6 @@ 'use strict'; import * as path from 'path'; -import * as fs from 'fs'; import { createConnection, @@ -27,7 +26,6 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; -import { execSync } from 'child_process'; import exhort from '@RHEcosystemAppEng/exhort-javascript-api'; @@ -200,7 +198,8 @@ const fetchVulnerabilities = async (fileType: string, reqData: any) => { 'EXHORT_MVN_PATH': globalSettings.mvnExecutable, 'EXHORT_NPM_PATH': globalSettings.npmExecutable, 'EXHORT_GO_PATH': globalSettings.goExecutable, - 'EXHORT_DEV_MODE': config.exhort_dev_mode + 'EXHORT_DEV_MODE': config.exhort_dev_mode, + 'RHDA_TOKEN': config.telemetry_id }; if (globalSettings.exhortSnykToken !== '') { options['EXHORT_SNYK_TOKEN'] = globalSettings.exhortSnykToken;