Add WithHttpsHealthCheck() to start template#8444
Conversation
As suggested here: #8139 (reply in thread)
There was a problem hiding this comment.
Pull Request Overview
This pull request updates the Aspire starter template so that the app host now includes health checks for both the API service and web frontend projects by using the WithHttpsHealthCheck extension with the endpoint "/health".
- Added health check configuration for the API service project.
- Added health check configuration for the web frontend project.
Comments suppressed due to low confidence (2)
src/Aspire.ProjectTemplates/templates/aspire-starter/9.2/Aspire-StarterApplication.1.AppHost/Program.cs:8
- The health check addition for the API service is not covered by any tests. Consider adding tests to verify its functionality.
.WithHttpsHealthCheck("/health");
src/Aspire.ProjectTemplates/templates/aspire-starter/9.2/Aspire-StarterApplication.1.AppHost/Program.cs:12
- The health check addition for the web frontend project is not covered by any tests. Consider adding tests to verify its functionality.
.WithHttpsHealthCheck("/health")
|
Does this need to handle http and https? |
|
Maybe only add to 1 of them to make it more obvious what the behavior it enables is? |
| #endif | ||
| var apiService = builder.AddProject<Projects.GeneratedClassNamePrefix_ApiService>("apiservice"); | ||
| var apiService = builder.AddProject<Projects.GeneratedClassNamePrefix_ApiService>("apiservice") | ||
| .WithHttpsHealthCheck("/health"); |
There was a problem hiding this comment.
would adding a comment to explain what this is doing be overkill? ie "Telling Aspire dashboard to show health checks from '/health' endpoint"
There was a problem hiding this comment.
Seems like overkill, the method signature help tooltip thing should explain it well enough?
The templates don't actually work without HTTPS out of the box today, they require manual changes. But, I should at least put the guard around this so that if you create it without HTTPS this calls the appropriate method. |
Description
Updates the starter template so that the app host health checks include checking the health checks endpoints of the two ASP.NET Core projects added via
WithHttpsHealthChecks("/health").As suggested here: #8139 (reply in thread)
Checklist