From 6ea8d78a0ad2e80648e35a7c25200fa187ef2dec Mon Sep 17 00:00:00 2001 From: kaje94 Date: Wed, 4 Feb 2026 12:03:31 +0530 Subject: [PATCH] add configs to manage architecture and skip keyring --- .../wso2-platform-extension/package.json | 19 ++++++++++++++++++- .../src/choreo-rpc/activate.ts | 4 ++-- .../src/choreo-rpc/cli-install.ts | 10 ++++++++-- .../src/choreo-rpc/connection.ts | 4 +++- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/workspaces/wso2-platform/wso2-platform-extension/package.json b/workspaces/wso2-platform/wso2-platform-extension/package.json index b568c4f4d9d..ada5e89d59f 100644 --- a/workspaces/wso2-platform/wso2-platform-extension/package.json +++ b/workspaces/wso2-platform/wso2-platform-extension/package.json @@ -3,7 +3,7 @@ "displayName": "WSO2 Platform", "description": "Manage WSO2 Choreo and Devant projects in VS Code.", "license": "Apache-2.0", - "version": "1.0.18", + "version": "1.0.19", "cliVersion": "v1.2.212509091800", "publisher": "wso2", "bugs": { @@ -176,6 +176,23 @@ "default": "", "description": "The path to Choreo RPC server", "scope": "window" + }, + "WSO2.WSO2-Platform.Advanced.RpcArchitecture": { + "type": "string", + "enum": [ + "", + "amd64", + "arm64" + ], + "default": "", + "description": "The architecture of Choreo RPC server. Change only if you are running within a container with a different architecture than your host machine.", + "scope": "window" + }, + "WSO2.WSO2-Platform.Advanced.SkipKeyring": { + "type": "boolean", + "default": false, + "description": "Enable only your system does not support keyring.", + "scope": "window" } } }, diff --git a/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/activate.ts b/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/activate.ts index 5a260f3332b..1d962910c9e 100644 --- a/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/activate.ts +++ b/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/activate.ts @@ -18,7 +18,7 @@ import { exec } from "child_process"; import * as fs from "fs"; -import { downloadCLI, getChoreoExecPath, getCliVersion } from "./cli-install"; +import { installCLI, getChoreoExecPath, getCliVersion } from "./cli-install"; import { RPCClient } from "./client"; import { getLogger } from "../logger/logger"; @@ -58,7 +58,7 @@ export async function initRPCServer() { const installed = await isChoreoCliInstalled(); if (!installed) { getLogger().trace(`WSO2 Platform RPC version ${getCliVersion()} not installed`); - await downloadCLI(); + await installCLI(); } await RPCClient.getInstance(); diff --git a/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/cli-install.ts b/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/cli-install.ts index 76afc0bc65b..315d67d6117 100644 --- a/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/cli-install.ts +++ b/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/cli-install.ts @@ -52,10 +52,12 @@ export const getChoreoEnv = (): string => { }; const getChoreoBinPath = () => { - return path.join(ext.context.globalStorageUri.fsPath, "choreo-cli-rpc", getCliVersion(), "bin"); + const OS = os.platform(); + const ARCH = getArchitecture(); + return path.join(ext.context.extensionPath, "resources", "choreo-cli", getCliVersion(), OS, ARCH, "bin"); }; -export const downloadCLI = async () => { +export const installCLI = async () => { const OS = os.platform(); const ARCH = getArchitecture(); const CHOREO_BIN_DIR = getChoreoBinPath(); @@ -167,6 +169,10 @@ export const downloadCLI = async () => { }; function getArchitecture() { + const arch = workspace.getConfiguration().get("WSO2.WSO2-Platform.Advanced.RpcArchitecture"); + if (arch) { + return arch; + } const ARCH = os.arch(); switch (ARCH) { case "x64": diff --git a/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/connection.ts b/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/connection.ts index f0ad6345870..1d81a4bb92f 100644 --- a/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/connection.ts +++ b/workspaces/wso2-platform/wso2-platform-extension/src/choreo-rpc/connection.ts @@ -23,6 +23,7 @@ import { ext } from "../extensionVariables"; import { getLogger } from "../logger/logger"; import { parseJwt } from "../utils"; import { getChoreoExecPath } from "./cli-install"; +import { workspace } from "vscode"; export class StdioConnection { private _connection: MessageConnection; @@ -43,10 +44,11 @@ export class StdioConnection { if (!region && process.env.CLOUD_STS_TOKEN && parseJwt(process.env.CLOUD_STS_TOKEN)?.iss?.includes(".eu.")) { region = "EU"; } + const skipKeyringConfig = workspace.getConfiguration().get("WSO2.WSO2-Platform.Advanced.SkipKeyring"); this._serverProcess = spawn(executablePath, ["start-rpc-server"], { env: { ...process.env, - SKIP_KEYRING: ext.isDevantCloudEditor ? "true" : "", + SKIP_KEYRING: (skipKeyringConfig || ext.isDevantCloudEditor) ? "true" : (process.env.SKIP_KEYRING || ""), CHOREO_ENV: ext.choreoEnv, CHOREO_REGION: region, },