Added healthchecks to server

This commit is contained in:
2025-07-06 09:55:18 +02:00
parent 1fe70264fd
commit 84a4a9d51e
4 changed files with 84 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ using ElmahCore;
using ElmahCore.Mvc;
using Serilog;
using Server;
using Server.HealthChecks;
var builder = WebApplication.CreateBuilder(args);
@@ -16,6 +17,9 @@ Log.Logger = new LoggerConfiguration()
.CreateLogger();
builder.Logging.AddSerilog();
builder.Services.AddSingleton<SearchdomainManager>();
builder.Services.AddHealthChecks()
.AddCheck<DatabaseHealthCheck>("DatabaseHealthCheck")
.AddCheck<AIProviderHealthCheck>("AIProviderHealthChecck");
builder.Services.AddElmah<XmlFileErrorLog>(Options =>
{
@@ -48,6 +52,8 @@ app.Use(async (context, next) =>
app.UseElmah();
app.MapHealthChecks("/healthz");
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{