diff --git a/src/config.ts b/src/config.ts index 74409f8af..2c37fc0a1 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'); @@ -50,7 +49,3 @@ export const config: Config = { serverMetadata: { id: '' }, goIOSTunnelInfoPort: 0, }; - -export async function loadFreePort() { - config.goIOSTunnelInfoPort = await getFreePort(); -} 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)}`);