Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 6e43584

Browse files
committed
Aggiornata documentazione
1 parent abf6790 commit 6e43584

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
```

0 commit comments

Comments
 (0)