diff --git a/Bootstrap.Admin/HealthChecks/DBHealthCheck.cs b/Bootstrap.Admin/HealthChecks/DBHealthCheck.cs index 4bf090ea..51f7efed 100644 --- a/Bootstrap.Admin/HealthChecks/DBHealthCheck.cs +++ b/Bootstrap.Admin/HealthChecks/DBHealthCheck.cs @@ -1,6 +1,7 @@ using Bootstrap.DataAccess; using Bootstrap.Security; using Microsoft.Extensions.Diagnostics.HealthChecks; +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -25,7 +26,13 @@ namespace Bootstrap.Admin.HealthChecks { var connStr = db.ConnectionString; var dicts = db.Fetch("Select * from Dicts"); - return dicts.Any() ? Task.FromResult(HealthCheckResult.Healthy("Ok")) : Task.FromResult(HealthCheckResult.Degraded("No init data in DB")); + var data = new Dictionary() + { + { "ConnectionString", connStr }, + { "DbType", db.Provider.GetType().Name }, + { "Dicts", dicts.Count } + }; + return dicts.Any() ? Task.FromResult(HealthCheckResult.Healthy("Ok", data)) : Task.FromResult(HealthCheckResult.Degraded("No init data in DB")); } } } diff --git a/Bootstrap.Admin/HealthChecks/FileHealCheck.cs b/Bootstrap.Admin/HealthChecks/FileHealCheck.cs index ef5ed450..591409f9 100644 --- a/Bootstrap.Admin/HealthChecks/FileHealCheck.cs +++ b/Bootstrap.Admin/HealthChecks/FileHealCheck.cs @@ -32,12 +32,14 @@ namespace Bootstrap.Admin.HealthChecks public Task CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) { var file = _env.IsDevelopment() ? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Longbow.lic") : Path.Combine(_env.ContentRootPath, "Longbow.lic"); - var data = new Dictionary(); - data.Add("ContentRootPath", _env.ContentRootPath); - data.Add("WebRootPath", _env.WebRootPath); - data.Add("ApplicationName", _env.ApplicationName); - data.Add("EnvironmentName", _env.EnvironmentName); - data.Add("CheckFile", file); + var data = new Dictionary + { + { "ApplicationName", _env.ApplicationName }, + { "EnvironmentName", _env.EnvironmentName }, + { "ContentRootPath", _env.ContentRootPath }, + { "WebRootPath", _env.WebRootPath }, + { "CheckFile", file } + }; return Task.FromResult(File.Exists(file) ? HealthCheckResult.Healthy("Ok", data) : HealthCheckResult.Unhealthy($"Missing file {file}", null, data)); } }