SQL HealthCheck
This commit is contained in:
+4
-1
@@ -33,7 +33,10 @@ builder.Services.AddOptions<DatabaseOptions>()
|
|||||||
.Validate(o => !string.IsNullOrWhiteSpace(o.ConnectionString), "DB connection string required")
|
.Validate(o => !string.IsNullOrWhiteSpace(o.ConnectionString), "DB connection string required")
|
||||||
.ValidateOnStart();
|
.ValidateOnStart();
|
||||||
|
|
||||||
// (Optional) health checks / metrics can be added here too.
|
builder.Services.AddHealthChecks()
|
||||||
|
.AddCheck<DatabaseHealthCheck>("mysql", tags: new[] { "ready" })
|
||||||
|
//.AddCheck<RedisHealthCheck>("redis", tags: new[] { "ready" })
|
||||||
|
;
|
||||||
|
|
||||||
// ---- Build the app AFTER all service registrations ----
|
// ---- Build the app AFTER all service registrations ----
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|||||||
Reference in New Issue
Block a user