From d17c98036b4ab729da8392aacd9d860f2ba3378b Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Tue, 2 Jan 2024 13:29:48 -0500 Subject: [PATCH] feat: Allow configuration of AppMap API URL --- package.json | 7 ++++++- src/configuration/extensionSettings.ts | 5 +++++ src/services/processWatcher.ts | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 01f1a5d3..bb9921ce 100644 --- a/package.json +++ b/package.json @@ -224,7 +224,12 @@ "appMap.applandUrl": { "type": "string", "default": "https://getappmap.com", - "description": "URL of an AppLand cloud instance for AppMap storage" + "description": "URL of AppMap" + }, + "appMap.apiUrl": { + "type": "string", + "default": "https://api.getappmap.com", + "description": "URL of the AppMap API" }, "appMap.viewConfiguration": { "type": "string", diff --git a/src/configuration/extensionSettings.ts b/src/configuration/extensionSettings.ts index 88939f51..1bc38251 100644 --- a/src/configuration/extensionSettings.ts +++ b/src/configuration/extensionSettings.ts @@ -1,3 +1,4 @@ +import { DefaultApiURL } from '@appland/client'; import * as vscode from 'vscode'; export default class ExtensionSettings { @@ -27,4 +28,8 @@ export default class ExtensionSettings { public static get appMapCommandLineToolsPath(): string | undefined { return vscode.workspace.getConfiguration('appMap').get('commandLineToolsPath'); } + + public static get apiUrl(): string { + return vscode.workspace.getConfiguration('appMap').get('apiUrl') || DefaultApiURL; + } } diff --git a/src/services/processWatcher.ts b/src/services/processWatcher.ts index f752eb35..4ec4399d 100644 --- a/src/services/processWatcher.ts +++ b/src/services/processWatcher.ts @@ -1,6 +1,7 @@ import * as vscode from 'vscode'; import { ChildProcess, OutputStream, spawn, SpawnOptions } from './nodeDependencyProcess'; import { getApiKey } from '../authentication'; +import ExtensionSettings from '../configuration/extensionSettings'; export type RetryOptions = { // The number of retries made before declaring the process as failed. @@ -198,6 +199,7 @@ export class ProcessWatcher implements vscode.Disposable { if (accessToken) { env.APPMAP_API_KEY = accessToken; } + env.APPMAP_API_URL = ExtensionSettings.apiUrl; return env; }