Skip to content

Commit

Permalink
fix: WebHooks configuration typos in json
Browse files Browse the repository at this point in the history
* Ensure we have 2 webhook endpoints
* Ensure the UI displays the webhooks information
* Unable to find UIWebHooksApiMiddleware unit tests
  • Loading branch information
Jamie-Clayton committed Jun 23, 2024
1 parent 1a9214b commit ab0eaf1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions samples/HealthChecks.UI.Branding/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public void ConfigureServices(IServiceCollection services)
setup.SetHeaderText("Branding Demo - Health Checks Status");
setup.AddHealthCheckEndpoint("endpoint1", "/health-random");
setup.AddHealthCheckEndpoint("endpoint2", "health-process");
//Webhook endpoint with custom notification hours, and custom failure and description messages
//Webhook endpoint with custom notification hours (8am - 5pm), and custom failure and description messages

setup.AddWebhookNotification("webhook1", uri: "https://healthchecks2.requestcatcher.com/",
payload: "{ message: \"Webhook report for [[LIVENESS]]: [[FAILURE]] - Description: [[DESCRIPTIONS]]\"}",
setup.AddWebhookNotification("webhook2", uri: "https://healthchecks2.requestcatcher.com/",
payload: "{ \"message\": \"Webhook2 report for [[LIVENESS]]: [[FAILURE]] - Description: [[DESCRIPTIONS]]\"}",
restorePayload: "{ message: \"[[LIVENESS]] is back to life\"}",
shouldNotifyFunc: (livenessName, report) => DateTime.UtcNow.Hour >= 8 && DateTime.UtcNow.Hour <= 23,
shouldNotifyFunc: (livenessName, report) => DateTime.UtcNow.Hour >= 8 && DateTime.UtcNow.Hour <= 17,
customMessageFunc: (livenessName, report) =>
{
var failing = report.Entries.Where(e => e.Value.Status == UIHealthStatus.Unhealthy);
Expand All @@ -46,11 +46,10 @@ public void ConfigureServices(IServiceCollection services)
setup.AddWebhookNotification(
name: "webhook1",
uri: "https://healthchecks.requestcatcher.com/",
payload: "{ message: \"Webhook report for [[LIVENESS]]: [[FAILURE]] - Description: [[DESCRIPTIONS]]\"}",
payload: "{ \"message\": \"Webhook1 report for [[LIVENESS]]: [[FAILURE]] - Description: [[DESCRIPTIONS]]\"}",
restorePayload: "{ message: \"[[LIVENESS]] is back to life\"}");
}).AddInMemoryStorage()
.Services
.AddControllers();
.Services.AddControllers();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down

0 comments on commit ab0eaf1

Please sign in to comment.