Skip to content

Commit

Permalink
feat: Allow configuration of AppMap API URL
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinbyrne committed Jan 16, 2024
1 parent c756752 commit d17c980
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/configuration/extensionSettings.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DefaultApiURL } from '@appland/client';
import * as vscode from 'vscode';

export default class ExtensionSettings {
Expand Down Expand Up @@ -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;
}
}
2 changes: 2 additions & 0 deletions src/services/processWatcher.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit d17c980

Please sign in to comment.