mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 21:44:25 -07:00
fix(ide): Update IDE extension to write auth token in env var (#14999)
This commit is contained in:
@@ -108,7 +108,7 @@ describe('IDEServer', () => {
|
|||||||
await ideServer.start(mockContext);
|
await ideServer.start(mockContext);
|
||||||
|
|
||||||
const replaceMock = mockContext.environmentVariableCollection.replace;
|
const replaceMock = mockContext.environmentVariableCollection.replace;
|
||||||
expect(replaceMock).toHaveBeenCalledTimes(2);
|
expect(replaceMock).toHaveBeenCalledTimes(3);
|
||||||
|
|
||||||
expect(replaceMock).toHaveBeenNthCalledWith(
|
expect(replaceMock).toHaveBeenNthCalledWith(
|
||||||
1,
|
1,
|
||||||
@@ -127,6 +127,12 @@ describe('IDEServer', () => {
|
|||||||
expectedWorkspacePaths,
|
expectedWorkspacePaths,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expect(replaceMock).toHaveBeenNthCalledWith(
|
||||||
|
3,
|
||||||
|
'GEMINI_CLI_IDE_AUTH_TOKEN',
|
||||||
|
'test-auth-token',
|
||||||
|
);
|
||||||
|
|
||||||
const port = getPortFromMock(replaceMock);
|
const port = getPortFromMock(replaceMock);
|
||||||
const expectedPortFile = path.join(
|
const expectedPortFile = path.join(
|
||||||
'/tmp',
|
'/tmp',
|
||||||
@@ -254,6 +260,10 @@ describe('IDEServer', () => {
|
|||||||
'GEMINI_CLI_IDE_WORKSPACE_PATH',
|
'GEMINI_CLI_IDE_WORKSPACE_PATH',
|
||||||
expectedWorkspacePaths,
|
expectedWorkspacePaths,
|
||||||
);
|
);
|
||||||
|
expect(replaceMock).toHaveBeenCalledWith(
|
||||||
|
'GEMINI_CLI_IDE_AUTH_TOKEN',
|
||||||
|
'test-auth-token',
|
||||||
|
);
|
||||||
|
|
||||||
const port = getPortFromMock(replaceMock);
|
const port = getPortFromMock(replaceMock);
|
||||||
const expectedPortFile = path.join(
|
const expectedPortFile = path.join(
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class CORSError extends Error {
|
|||||||
const MCP_SESSION_ID_HEADER = 'mcp-session-id';
|
const MCP_SESSION_ID_HEADER = 'mcp-session-id';
|
||||||
const IDE_SERVER_PORT_ENV_VAR = 'GEMINI_CLI_IDE_SERVER_PORT';
|
const IDE_SERVER_PORT_ENV_VAR = 'GEMINI_CLI_IDE_SERVER_PORT';
|
||||||
const IDE_WORKSPACE_PATH_ENV_VAR = 'GEMINI_CLI_IDE_WORKSPACE_PATH';
|
const IDE_WORKSPACE_PATH_ENV_VAR = 'GEMINI_CLI_IDE_WORKSPACE_PATH';
|
||||||
|
const IDE_AUTH_TOKEN_ENV_VAR = 'GEMINI_CLI_IDE_AUTH_TOKEN';
|
||||||
|
|
||||||
interface WritePortAndWorkspaceArgs {
|
interface WritePortAndWorkspaceArgs {
|
||||||
context: vscode.ExtensionContext;
|
context: vscode.ExtensionContext;
|
||||||
@@ -70,6 +71,10 @@ async function writePortAndWorkspace({
|
|||||||
IDE_WORKSPACE_PATH_ENV_VAR,
|
IDE_WORKSPACE_PATH_ENV_VAR,
|
||||||
workspacePath,
|
workspacePath,
|
||||||
);
|
);
|
||||||
|
context.environmentVariableCollection.replace(
|
||||||
|
IDE_AUTH_TOKEN_ENV_VAR,
|
||||||
|
authToken,
|
||||||
|
);
|
||||||
|
|
||||||
const content = JSON.stringify({
|
const content = JSON.stringify({
|
||||||
port,
|
port,
|
||||||
|
|||||||
Reference in New Issue
Block a user