From 1a9e9c78ab222667e23dc335fb5932efd5913296 Mon Sep 17 00:00:00 2001 From: Sudharsan Selvaraj Date: Wed, 29 Oct 2025 17:24:01 +0530 Subject: [PATCH 1/2] fix: update config to load freeport during plugin initialization --- src/config.ts | 7 +------ src/plugin.ts | 5 +++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/config.ts b/src/config.ts index 74409f8af..825910ed4 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,7 +2,6 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import { v4 as uuid } from 'uuid'; -import { getFreePort } from './helpers'; import { Config } from './types/Config'; const basePath = path.join(os.homedir(), '.cache', 'appium-device-farm'); @@ -49,8 +48,4 @@ export const config: Config = { appsPath: path.join(deviceFarmHome, 'assets'), serverMetadata: { id: '' }, goIOSTunnelInfoPort: 0, -}; - -export async function loadFreePort() { - config.goIOSTunnelInfoPort = await getFreePort(); -} +}; \ No newline at end of file diff --git a/src/plugin.ts b/src/plugin.ts index 461f7c4f8..06db26969 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -59,7 +59,8 @@ import ip from 'ip'; import _ from 'lodash'; import { DeviceFarmApiClient } from './api-client'; import { getDeviceFarmCapabilities } from './CapabilityManager'; -import { config, loadFreePort, config as pluginConfig } from './config'; +import { config, config as pluginConfig } from './config'; +import { getFreePort } from './helpers'; import { ATDRepository } from './data-service/db'; import { NodeService } from './data-service/node-service'; import { addCLIArgs } from './data-service/pluginArgs'; @@ -144,7 +145,7 @@ class DevicePlugin extends BasePlugin { httpServer: any, cliArgs: ServerArgs, ): Promise { - await loadFreePort(); + config.goIOSTunnelInfoPort = await getFreePort(); DevicePlugin.httpServer = httpServer; log.debug(`📱 Update server with CLI Args: ${JSON.stringify(cliArgs)}`); From dca82fe200e3d28fc14b6fabd426ab4aadd08272 Mon Sep 17 00:00:00 2001 From: Sudharsan Selvaraj Date: Wed, 29 Oct 2025 17:44:22 +0530 Subject: [PATCH 2/2] fix styling issue --- src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index 825910ed4..2c37fc0a1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -48,4 +48,4 @@ export const config: Config = { appsPath: path.join(deviceFarmHome, 'assets'), serverMetadata: { id: '' }, goIOSTunnelInfoPort: 0, -}; \ No newline at end of file +};