Skip to content

Commit

Permalink
allow remote xctest connections w/ a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
herval committed Dec 11, 2024
1 parent 10019b5 commit e9d684c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e9d684c

Please sign in to comment.