(resolvedOptions: ResolvedOptions, framework?: Framework)
| 438 | } |
| 439 | |
| 440 | function findServerUrls(resolvedOptions: ResolvedOptions, framework?: Framework): ServerUrl[] { |
| 441 | if (resolvedOptions.tunnel) { |
| 442 | logger.info(` Using provided tunnel URL: ${resolvedOptions.tunnel}`); |
| 443 | return [{ type: "tunnel", url: resolvedOptions.tunnel }]; |
| 444 | } |
| 445 | |
| 446 | //create list of hostnames to try |
| 447 | const hostnames = []; |
| 448 | if (resolvedOptions.hostname) { |
| 449 | hostnames.push(resolvedOptions.hostname); |
| 450 | } |
| 451 | if (framework) { |
| 452 | hostnames.push(...framework.defaultHostnames); |
| 453 | } else { |
| 454 | hostnames.push("localhost"); |
| 455 | } |
| 456 | |
| 457 | //create list of ports to try |
| 458 | const ports = []; |
| 459 | if (resolvedOptions.port) { |
| 460 | ports.push(resolvedOptions.port); |
| 461 | } |
| 462 | if (framework) { |
| 463 | ports.push(...framework.defaultPorts); |
| 464 | } else { |
| 465 | ports.push(3000); |
| 466 | } |
| 467 | |
| 468 | //create list of urls to try |
| 469 | const urls: ResolvedUrl[] = []; |
| 470 | for (const hostname of hostnames) { |
| 471 | for (const port of ports) { |
| 472 | urls.push({ type: "resolved", hostname, port, https: resolvedOptions.https ?? false }); |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | return urls; |
| 477 | } |
| 478 | |
| 479 | async function resolveEndpointUrl(apiUrl: string, apiKey: string, endpoint: ServerEndpoint) { |
| 480 | // use tunnel URL if provided |
no test coverage detected
searching dependent graphs…