From 5611d6c21d9668fa4dbad445033c5dcf2a4d8d93 Mon Sep 17 00:00:00 2001 From: Andrew Horth Date: Fri, 26 Jul 2024 17:56:07 +0100 Subject: [PATCH] Amended DB health checks to use NpgsqlDataSource --- .../src/TeachingRecordSystem.ServiceDefaults/Extensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.ServiceDefaults/Extensions.cs b/TeachingRecordSystem/src/TeachingRecordSystem.ServiceDefaults/Extensions.cs index 1dd5a65e5..e905d9e4c 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.ServiceDefaults/Extensions.cs +++ b/TeachingRecordSystem/src/TeachingRecordSystem.ServiceDefaults/Extensions.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Npgsql; using Prometheus; using TeachingRecordSystem.Core.Infrastructure.Configuration; using TeachingRecordSystem.ServiceDefaults.Infrastructure.Logging; @@ -23,7 +24,7 @@ public static IHostApplicationBuilder AddServiceDefaults( builder.AddHangfire(); builder.AddBackgroundWorkScheduler(); - builder.Services.AddHealthChecks().AddNpgSql(builder.Configuration.GetPostgresConnectionString()); + builder.Services.AddHealthChecks().AddNpgSql(sp => sp.GetRequiredService()); builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder.Services.AddSingleton();