File tree Expand file tree Collapse file tree
BuildingBlocks/Healthchecks/Extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,12 +8,10 @@ namespace SysArx.BuildingBlocks.Healthchecks.Extensions;
88
99public static class HealthCheckExtensions
1010{
11- public static IServiceCollection AddCustomHealthChecks ( this IServiceCollection services )
11+ public static IHealthChecksBuilder AddCustomHealthChecks ( this IServiceCollection services )
1212 {
13- services . AddHealthChecks ( )
13+ return services . AddHealthChecks ( )
1414 . AddCheck ( "self" , ( ) => HealthCheckResult . Healthy ( ) ) ;
15-
16- return services ;
1715 }
1816
1917 public static void MapCustomHealthChecks (
Original file line number Diff line number Diff line change 11using Serilog ;
22using SysArx . BuildingBlocks . Authentication . Extensions ;
33using SysArx . BuildingBlocks . Healthchecks . Extensions ;
4- using AspNetCore . HealthChecks . UI . Client ;
54using Microsoft . AspNetCore . Diagnostics . HealthChecks ;
5+ using HealthChecks . UI . Client ;
66
77var appName = "Auth API" ;
88var builder = WebApplication . CreateBuilder ( args ) ;
Original file line number Diff line number Diff line change 33using SysArx . BuildingBlocks . Healthchecks . Extensions ;
44using SysArx . BuildingBlocks . Authentication . Extensions ;
55using SysArx . Services . SysMLDiagram . Services ;
6- using AspNetCore . HealthChecks . UI . Client ;
6+ using Microsoft . AspNetCore . Diagnostics . HealthChecks ;
7+ using HealthChecks . UI . Client ;
78
89var appName = "SysMLDiagram API" ;
910var builder = WebApplication . CreateBuilder ( args ) ;
Original file line number Diff line number Diff line change 11using Serilog ;
2+ using Dapr . Client ;
3+ using Dapr . Extensions . Configuration ;
24using SysArx . BuildingBlocks . EventBus . Extensions ;
35using SysArx . BuildingBlocks . Healthchecks . Extensions ;
46using SysArx . BuildingBlocks . Authentication . Extensions ;
57using SysArx . Services . SysMLStore . Services ;
68using SysArx . Services . SysMLStore . Settings ;
79using SysArx . Services . SysMLStore . Storage ;
8- using AspNetCore . HealthChecks . UI . Client ;
10+ using Microsoft . AspNetCore . Diagnostics . HealthChecks ;
11+ using HealthChecks . UI . Client ;
912
1013var appName = "SysMLStore API" ;
1114var builder = WebApplication . CreateBuilder ( args ) ;
6568} ) ;
6669
6770// Add health checks
71+ var mongoConnectionString = builder . Configuration . GetValue < string > ( "MongoDbSettings:ConnectionString" ) ?? "mongodb://localhost:27017" ;
72+ builder . Services . AddSingleton < MongoDB . Driver . IMongoClient > ( sp =>
73+ new MongoDB . Driver . MongoClient ( mongoConnectionString ) ) ;
74+
6875builder . Services . AddCustomHealthChecks ( )
6976 . AddMongoDb (
70- builder . Configuration . GetValue < string > ( "MongoDbSettings:ConnectionString" ) ?? "mongodb://localhost:27017" ,
77+ sp => sp . GetRequiredService < MongoDB . Driver . IMongoClient > ( ) ,
7178 name : "mongodb" ,
7279 tags : new [ ] { "ready" } ) ;
7380
You can’t perform that action at this time.
0 commit comments