From e52fea9fc433bedcee1b7d44d19d669238c0ba70 Mon Sep 17 00:00:00 2001 From: michelkaporin Date: Wed, 4 Aug 2021 12:50:50 +0200 Subject: [PATCH] feat: allow custom base url configuration for dev work, do not use replaceAll as it breaks the extension --- src/snyk/common/configuration.ts | 6 +++++- src/snyk/common/constants/general.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/snyk/common/configuration.ts b/src/snyk/common/configuration.ts index 0ca94f029..5f73c8c7f 100644 --- a/src/snyk/common/configuration.ts +++ b/src/snyk/common/configuration.ts @@ -47,7 +47,11 @@ export class Configuration implements IConfiguration { } get baseURL(): string { - return this.isDevelopment ? 'https://deeproxy.dev.snyk.io' : this.defaultBaseURL; + if (this.isDevelopment) { + return process.env.SNYK_VSCE_DEVELOPMENT_SNYKCODE_BASE_URL ?? 'https://deeproxy.dev.snyk.io'; + } + + return this.defaultBaseURL; } get authHost(): string { diff --git a/src/snyk/common/constants/general.ts b/src/snyk/common/constants/general.ts index 859ee2429..1b1bb4a6a 100644 --- a/src/snyk/common/constants/general.ts +++ b/src/snyk/common/constants/general.ts @@ -1,7 +1,7 @@ // Changing this requires changing display name in package.json. export const SNYK_NAME = 'Snyk Vulnerability Scanner'; -export const SNYK_NAME_EXTENSION = SNYK_NAME.toLowerCase().replaceAll(' ', '-'); export const SNYK_PUBLISHER = 'snyk-security'; +export const SNYK_NAME_EXTENSION = SNYK_NAME.toLowerCase().replace(/\s/g, '-'); export const MAX_CONNECTION_RETRIES = 5; // max number of automatic retries before showing an error export const IDE_NAME = 'vscode'; export const COMMAND_DEBOUNCE_INTERVAL = 200; // 200 milliseconds