This repository was archived by the owner on Apr 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
src/NET6CustomLibrary/Docs Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ The extensions methods available regarding:
2525- DBContext generic CRUD methods
2626- DBContext Pool MySQL / MariaDB
2727- Health Checks MySQL / MariaDB
28+ - Health Checks PostgreSQL
2829- Json
2930- MailKit
3031- Multi language support
Original file line number Diff line number Diff line change 1+ # Health Checks configuration for Postgresql database
2+
3+
4+ ## Configuration to add to the appsettings.json file
5+
6+ ``` json
7+ "ConnectionStrings" : {
8+ "Default" : " Host=[SERVER];Port=5432;Database=[DATABASE];Username=[USERNAME];Password=[PASSWORD]"
9+ },
10+ ```
11+
12+ <b >Note:</b > The default port for Postgresql is 5432, but it can be changed as needed according to your needs.
13+
14+
15+ ## Registering services at Startup
16+
17+ ``` csharp
18+ public Startup (IConfiguration configuration )
19+ {
20+ Configuration = configuration ;
21+ }
22+
23+ public IConfiguration Configuration { get ; }
24+
25+ public void ConfigureServices (IServiceCollection services )
26+ {
27+ var connectionString = Configuration .GetSection (" ConnectionStrings" ).GetValue <string >(" Default" );
28+ services .AddPostgresHealthChecks (connectionString , " Postgres" );
29+ }
30+
31+ // OMISSIS
32+
33+ public void Configure (WebApplication app )
34+ {
35+ // OMISSIS
36+
37+ app .UseEndpoints (endpoints =>
38+ {
39+ endpoints .MapControllers ();
40+ endpoints .AddDatabaseHealthChecks (" /status" );
41+ }
42+ }
43+ ```
You can’t perform that action at this time.
0 commit comments