Skip to content

Commit

Permalink
hacks to make demo work when ngrok is used for api calls but keycloak…
Browse files Browse the repository at this point in the history
… doesn't know about the ngrok url
  • Loading branch information
lukemarsden committed Nov 9, 2024
1 parent fc37845 commit 85694a9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/cmd/helix/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ const htmlTemplate = `
if (window.location.protocol === 'file:') {
window.open(url, '_blank');
} else {
// typically ngrok URLs don't have keycloak properly configured
// to use the ngrok url, so use localhost in that case
if (url.includes('ngrok')) {
url = url.replace(/https?:\/\/[^\/]+/, 'http://localhost:8080');
}
openDashboard(url);
}
}
Expand Down Expand Up @@ -755,6 +760,11 @@ func writeResultsToFile(results []TestResult, totalTime time.Duration, helixYaml
fmt.Printf("\nResults written to %s\n", jsonFilename)
fmt.Printf("HTML report written to %s\n", htmlFilename)
fmt.Printf("Summary written to %s\n", summaryFilename)
helixURL := getHelixURL()
if strings.Contains(helixURL, "ngrok") {
helixURL = "http://localhost:8080"
}
fmt.Printf("View results at: %s/files?path=/test-runs/%s\n", helixURL, testID)

// Attempt to open the HTML report in the default browser
if isGraphicalEnvironment() {
Expand Down

0 comments on commit 85694a9

Please sign in to comment.