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();