From e9d684cac89cf11ff3426d637b2c98a4dc28e176 Mon Sep 17 00:00:00 2001 From: herval Date: Mon, 9 Dec 2024 13:56:58 -0500 Subject: [PATCH] allow remote xctest connections w/ a flag --- .../maestro-driver-iosUITests/Routes/XCTestHTTPServer.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/maestro-ios-xctest-runner/maestro-driver-iosUITests/Routes/XCTestHTTPServer.swift b/maestro-ios-xctest-runner/maestro-driver-iosUITests/Routes/XCTestHTTPServer.swift index 061034c4df..546b69a129 100644 --- a/maestro-ios-xctest-runner/maestro-driver-iosUITests/Routes/XCTestHTTPServer.swift +++ b/maestro-ios-xctest-runner/maestro-driver-iosUITests/Routes/XCTestHTTPServer.swift @@ -26,8 +26,10 @@ enum Route: String, CaseIterable { struct XCTestHTTPServer { func start() async throws { let port = ProcessInfo.processInfo.environment["PORT"]?.toUInt16() - let server = HTTPServer(address: .loopback(port: port ?? 22087), timeout: 100) - + let acceptRemoteConnections = ProcessInfo.processInfo.environment["ACCEPT_REMOTE_CONNECTIONS"] == "true" + + let address: HTTPServer.Address = acceptRemoteConnections ? .any(port: port) : .loopback(port: port) + for route in Route.allCases { let handler = await RouteHandlerFactory.createRouteHandler(route: route) await server.appendRoute(route.toHTTPRoute(), to: handler)