Skip to content

Commit 531e14b

Browse files
bmiddhaCopilot
andauthored
[debug-certificate-manager] add homeDirectory config (#5809)
* Add homeDirectory config to debug certificate manager extension Adds a new extension setting that, when set, is used as the resolved home directory for expanding `~` in the workspace certificate store path, overriding both the local `os.homedir()` lookup and the terminal-based resolution used in remote workspaces. Recommended to be configured at the user level rather than per-workspace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Bump debug-certificate-manager to 0.0.8 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e625a0f commit 531e14b

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

vscode-extensions/debug-certificate-manager-vscode-extension/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "debug-certificate-manager",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/microsoft/rushstack.git",
@@ -101,6 +101,11 @@
101101
"title": "Automatically Sync Certificates",
102102
"default": true,
103103
"description": "Check certificates when extension is activated. Extension is automatically activated when a `.vscode/debug-certificate-manager.json` file is present in the workspace."
104+
},
105+
"debugCertificateManager.homeDirectory": {
106+
"type": "string",
107+
"title": "Home Directory",
108+
"description": "Absolute path to the home directory, used to resolve `~` in the workspace certificate store path. When set, this overrides the default behavior (`os.homedir()` for local workspaces, or running a command in a workspace terminal for remote workspaces like Codespaces, SSH, Dev Containers, WSL, or Tunnels). Note: this setting is recommended to be configured at the user level, not the workspace level."
104109
}
105110
}
106111
}

vscode-extensions/debug-certificate-manager-vscode-extension/src/config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ import {
1111
CONFIG_CA_CERTIFICATE_FILENAME,
1212
CONFIG_CERTIFICATE_FILENAME,
1313
CONFIG_KEY_FILENAME,
14+
CONFIG_HOME_DIRECTORY,
1415
CONFIG_STORE_PATH
1516
} from './constants';
1617

1718
type StorePaths = Record<'windows' | 'linux' | 'osx', string>;
1819
export interface IExtensionConfig extends ICertificateStoreOptions {
1920
autoSync: boolean;
21+
homeDirectory: string | undefined;
2022
}
2123

2224
export function getConfig(terminal: ITerminal): IExtensionConfig {
@@ -27,6 +29,8 @@ export function getConfig(terminal: ITerminal): IExtensionConfig {
2729
config.get(CONFIG_CERTIFICATE_FILENAME) || 'rushstack-serve.pem';
2830
const keyFilename: string | undefined = config.get(CONFIG_KEY_FILENAME) || 'rushstack-serve.key';
2931
const autoSync: boolean = config.get(CONFIG_AUTOSYNC) ?? false;
32+
const homeDirectory: string | undefined =
33+
config.get<string>(CONFIG_HOME_DIRECTORY) || undefined;
3034
let storePath: string | undefined = undefined;
3135

3236
const platformMap: Record<string, keyof StorePaths> = {
@@ -54,7 +58,8 @@ export function getConfig(terminal: ITerminal): IExtensionConfig {
5458
caCertificateFilename,
5559
certificateFilename,
5660
keyFilename,
57-
autoSync
61+
autoSync,
62+
homeDirectory
5863
};
5964
terminal.writeLine(`Extension config: ${JSON.stringify(extensionConfig)}`);
6065
return extensionConfig;

vscode-extensions/debug-certificate-manager-vscode-extension/src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ export const CONFIG_CA_CERTIFICATE_FILENAME: string = 'caCertificateFilename';
2020
export const CONFIG_CERTIFICATE_FILENAME: string = 'certificateFilename';
2121
export const CONFIG_KEY_FILENAME: string = 'keyFilename';
2222
export const CONFIG_STORE_PATH: string = 'storePath';
23+
export const CONFIG_HOME_DIRECTORY: string = 'homeDirectory';
2324

2425
export const VSCODE_COMMAND_WORKSPACE_OPEN_SETTINGS: string = 'workbench.action.openSettings';

vscode-extensions/debug-certificate-manager-vscode-extension/src/extension.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ export function activate(context: vscode.ExtensionContext): void {
206206
} else if (storePath.startsWith('~')) {
207207
let homeDir: string;
208208

209-
if (vscode.env.remoteName) {
209+
const { homeDirectory } = getConfig(terminal);
210+
if (homeDirectory) {
211+
homeDir = homeDirectory;
212+
terminal.writeLine(`Using configured home directory: ${homeDir}`);
213+
} else if (vscode.env.remoteName) {
210214
const markerPrefix: string = '<<<HOMEDIR_START>>>';
211215
const markerSuffix: string = '<<<HOMEDIR_END>>>';
212216
const output: string = await runWorkspaceCommandAsync({

0 commit comments

Comments
 (0)