mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 15:01:56 +00:00
Added LDAP health checks
This commit is contained in:
@@ -4,6 +4,7 @@ using Serilog;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Berufsschule_HAM.Services;
|
||||
using Berufsschule_HAM.Models;
|
||||
using Berufsschule_HAM.HealthChecks;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Bind options
|
||||
@@ -26,6 +27,9 @@ builder.Services.AddElmah<XmlFileErrorLog>(Options =>
|
||||
builder.Services.AddSingleton<LdapService>();
|
||||
builder.Services.AddSingleton<MigrationService>();
|
||||
|
||||
builder.Services.AddHealthChecks()
|
||||
.AddCheck<DatabaseHealthCheck>("DatabaseHealthCheck");
|
||||
|
||||
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||
.AddCookie(options =>
|
||||
{
|
||||
@@ -53,6 +57,8 @@ app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.MapHealthChecks("/healthz");
|
||||
|
||||
// Run migrations
|
||||
using var scope = app.Services.CreateScope();
|
||||
var migrationService = scope.ServiceProvider.GetRequiredService<MigrationService>();
|
||||
|
||||
Reference in New Issue
Block a user