Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -50,7 +49,3 @@ export const config: Config = {
serverMetadata: { id: '' },
goIOSTunnelInfoPort: 0,
};

export async function loadFreePort() {
config.goIOSTunnelInfoPort = await getFreePort();
}
5 changes: 3 additions & 2 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -144,7 +145,7 @@ class DevicePlugin extends BasePlugin {
httpServer: any,
cliArgs: ServerArgs,
): Promise<void> {
await loadFreePort();
config.goIOSTunnelInfoPort = await getFreePort();
DevicePlugin.httpServer = httpServer;

log.debug(`📱 Update server with CLI Args: ${JSON.stringify(cliArgs)}`);
Expand Down