0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-08-23 19:58:34 +00:00

Add more health checks

This commit is contained in:
Alexander Konietzko 2023-05-29 15:34:34 +02:00
parent 31681617d9
commit c72384431b
No known key found for this signature in database
GPG Key ID: BA6905F37AEC2B5B
2 changed files with 6 additions and 1 deletions

View File

@ -7,6 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.ApplicationStatus" Version="6.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.5" />

View File

@ -4,6 +4,7 @@ using CleanArchitecture.Application.gRPC;
using CleanArchitecture.Domain.Extensions;
using CleanArchitecture.Infrastructure.Database;
using CleanArchitecture.Infrastructure.Extensions;
using HealthChecks.ApplicationStatus.DependencyInjection;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
@ -20,7 +21,9 @@ builder.Services.AddEndpointsApiExplorer();
builder.Services
.AddHealthChecks()
.AddDbContextCheck<ApplicationDbContext>();
.AddDbContextCheck<ApplicationDbContext>()
.AddSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")!)
.AddApplicationStatus();
builder.Services.AddDbContext<ApplicationDbContext>(options =>
{