From cab1b170c1218c47c5c4f366425731c3fdb5d67a Mon Sep 17 00:00:00 2001 From: whoswhip Date: Tue, 30 Dec 2025 21:19:10 -0500 Subject: [PATCH] feat: add health checks for database connectivity --- SharpbinV3.Server/Program.cs | 5 +++++ SharpbinV3.Server/SharpbinV3.Server.csproj | 1 + 2 files changed, 6 insertions(+) diff --git a/SharpbinV3.Server/Program.cs b/SharpbinV3.Server/Program.cs index 1b4adbf..5341d5e 100644 --- a/SharpbinV3.Server/Program.cs +++ b/SharpbinV3.Server/Program.cs @@ -30,6 +30,9 @@ namespace SharpbinV3.Server builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); + + builder.Services.AddHealthChecks() + .AddDbContextCheck("Database"); builder.Services .AddAuthentication(JwtBearerDefaults.AuthenticationScheme) @@ -105,6 +108,8 @@ namespace SharpbinV3.Server db.Database.Migrate(); } + app.MapHealthChecks("/health"); + app.Run(); } } diff --git a/SharpbinV3.Server/SharpbinV3.Server.csproj b/SharpbinV3.Server/SharpbinV3.Server.csproj index 3b043d5..edd1d2c 100644 --- a/SharpbinV3.Server/SharpbinV3.Server.csproj +++ b/SharpbinV3.Server/SharpbinV3.Server.csproj @@ -25,6 +25,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive +