diff --git a/src/admin/Bootstrap.Admin/HealthChecks/HealthChecksBuilderExtensions.cs b/src/admin/Bootstrap.Admin/HealthChecks/HealthChecksBuilderExtensions.cs index ebcb5d58..20889596 100644 --- a/src/admin/Bootstrap.Admin/HealthChecks/HealthChecksBuilderExtensions.cs +++ b/src/admin/Bootstrap.Admin/HealthChecks/HealthChecksBuilderExtensions.cs @@ -1,4 +1,5 @@ using Bootstrap.Admin.HealthChecks; +using Microsoft.Extensions.Configuration; namespace Microsoft.Extensions.DependencyInjection { @@ -17,7 +18,10 @@ namespace Microsoft.Extensions.DependencyInjection var builder = services.AddHealthChecks(); builder.AddCheck("db"); builder.AddBootstrapAdminHealthChecks(); - builder.AddCheck("Gitee"); + + var config = services.BuildServiceProvider().GetRequiredService(); + var checkGitee = config.GetValue("GiteeHealthChecks", false); + if (checkGitee) builder.AddCheck("Gitee"); return services; } } diff --git a/src/admin/Bootstrap.Admin/appsettings.json b/src/admin/Bootstrap.Admin/appsettings.json index 605fc91e..877e3667 100644 --- a/src/admin/Bootstrap.Admin/appsettings.json +++ b/src/admin/Bootstrap.Admin/appsettings.json @@ -55,6 +55,7 @@ ], "SwaggerPathBase": "", "AllowOrigins": "http://localhost,http://ba.sdgxgz.cn", + "GiteeHealthChecks": false, "Sentry": { "Dsn": "https://70bdfff562e84fa7b9a43d65924ab9ad@sentry.io/1469396" },