Skip to content

Commit

Permalink
Amended DB health checks to use NpgsqlDataSource
Browse files Browse the repository at this point in the history
  • Loading branch information
hortha committed Jul 26, 2024
1 parent 1680605 commit 5611d6c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<NpgsqlDataSource>());
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
builder.Services.AddSingleton<UrlRedactor>();

Expand Down

0 comments on commit 5611d6c

Please sign in to comment.