Skip to content

Commit

Permalink
feat: added MATCH_MANIFEST_VERSIONS to config and Exhort JS API request
Browse files Browse the repository at this point in the history
Signed-off-by: Ilona Shishov <[email protected]>
  • Loading branch information
IlonaShishov committed Oct 22, 2023
1 parent 68c9e85 commit cc9c92b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class Config
{
exhort_snyk_token: string;
match_manifest_versions: boolean;
provide_fullstack_action: boolean;
forbidden_licenses: Array<string>;
no_crypto: boolean;
Expand All @@ -26,6 +27,7 @@ class Config
constructor() {
// TODO: this needs to be configurable
this.exhort_snyk_token = process.env.SNYK_TOKEN || '';
this.match_manifest_versions = (process.env.MATCH_MANIFEST_VERSIONS || '') === 'true';
this.provide_fullstack_action = (process.env.PROVIDE_FULLSTACK_ACTION || '') === 'true';
this.forbidden_licenses = [];
this.no_crypto = false;
Expand Down
6 changes: 5 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ connection.onInitialize((params): InitializeResult => {
// Defining settings for Red Hat Dependency Analytics
interface RedhatDependencyAnalyticsSettings {
exhortSnykToken: string;
matchManifestVersions: boolean;
mvnExecutable: string;
npmExecutable: string;
goExecutable: string;
Expand All @@ -74,6 +75,7 @@ interface RedhatDependencyAnalyticsSettings {
// Initializing default settings for Red Hat Dependency Analytics
const defaultSettings: RedhatDependencyAnalyticsSettings = {
exhortSnykToken: config.exhort_snyk_token,
matchManifestVersions: config.match_manifest_versions,
mvnExecutable: config.mvn_executable,
npmExecutable: config.npm_executable,
goExecutable: config.go_executable,
Expand Down Expand Up @@ -211,7 +213,8 @@ const fetchVulnerabilities = async (fileType: string, reqData: any) => {
'EXHORT_PIP_PATH': globalSettings.pipExecutable,
'EXHORT_DEV_MODE': config.exhort_dev_mode,
'RHDA_TOKEN': config.telemetry_id,
'RHDA_SOURCE': config.utm_source
'RHDA_SOURCE': config.utm_source,
'MATCH_MANIFEST_VERSIONS': globalSettings.matchManifestVersions
};
if (globalSettings.exhortSnykToken !== '') {
options['EXHORT_SNYK_TOKEN'] = globalSettings.exhortSnykToken;
Expand Down Expand Up @@ -368,6 +371,7 @@ connection.onDidChangeConfiguration(() => {
// Updating global settings based on the fetched configuration data.
globalSettings = ({
exhortSnykToken: data.redHatDependencyAnalytics.exhortSnykToken,
matchManifestVersions: data.redHatDependencyAnalytics.matchManifestVersions,
mvnExecutable: data.mvn.executable.path || 'mvn',
npmExecutable: data.npm.executable.path || 'npm',
goExecutable: data.go.executable.path || 'go',
Expand Down

0 comments on commit cc9c92b

Please sign in to comment.