这是基于vue-vben-admin 模板适用于abp vNext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
1.1 KiB

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
namespace LINGYUN.Abp.MicroService.ServiceDefaults;
public static class HealthChecksExtenssions
{
public static IHostApplicationBuilder AddCustomHealthChecks<THealthCheck>(
this IHostApplicationBuilder builder,
string name,
string tag = "ready")
where THealthCheck : class, IHealthCheck
{
builder.Services
.AddHealthChecks()
.AddCheck<THealthCheck>(name, tags: [tag]);
return builder;
}
public static WebApplication MapCustomHealthChecks(
this WebApplication app,
string pattern,
string tag = "ready")
{
if (app.Environment.IsDevelopment())
{
app.MapHealthChecks(pattern, new HealthCheckOptions
{
Predicate = r => r.Tags.Contains(tag)
});
}
return app;
}
}