2019-08-13 14:19:27 +08:00
|
|
|
|
using Bootstrap.Admin.HealthChecks;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
2019-08-13 13:39:18 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 健康检查扩展类
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class HealthChecksBuilderExtensions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加 BootstrapAdmin 健康检查
|
|
|
|
|
/// </summary>
|
2019-08-24 01:58:38 +08:00
|
|
|
|
/// <param name="services"></param>
|
2019-08-13 13:39:18 +08:00
|
|
|
|
/// <returns></returns>
|
2019-08-24 01:58:38 +08:00
|
|
|
|
public static IServiceCollection AddAdminHealthChecks(this IServiceCollection services)
|
2019-08-13 13:39:18 +08:00
|
|
|
|
{
|
2019-08-24 01:58:38 +08:00
|
|
|
|
var builder = services.AddHealthChecks();
|
2019-08-13 14:19:27 +08:00
|
|
|
|
builder.AddCheck<DBHealthCheck>("db");
|
2019-08-24 01:58:38 +08:00
|
|
|
|
builder.AddBootstrapAdminHealthChecks();
|
2019-08-13 15:55:55 +08:00
|
|
|
|
builder.AddCheck<GiteeHttpHealthCheck>("Gitee");
|
2019-08-24 01:58:38 +08:00
|
|
|
|
return services;
|
2019-08-13 13:39:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|