From 1fb899da2b4e6f180427595ff8eb3237b6c9fdf2 Mon Sep 17 00:00:00 2001 From: Nick Blakely Date: Mon, 5 Sep 2022 21:53:54 -0700 Subject: [PATCH] Enable health checks. --- Giants.WebApi/Program.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Giants.WebApi/Program.cs b/Giants.WebApi/Program.cs index e3ca1a4..561e0d2 100644 --- a/Giants.WebApi/Program.cs +++ b/Giants.WebApi/Program.cs @@ -47,8 +47,6 @@ namespace Giants.Web services.AddApplicationInsightsTelemetry(); - IdentityModelEventSource.ShowPII = true; - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApi(options => { @@ -94,14 +92,17 @@ namespace Giants.Web IMapper mapper = Services.Mapper.GetMapper(); services.AddSingleton(mapper); + services.AddHealthChecks(); + builder.Logging.AddEventSourceLogger(); + builder.Logging.AddApplicationInsights(); } private static void ConfigureApplication(WebApplication app, IWebHostEnvironment env) { if (env.IsDevelopment()) { - Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true; + IdentityModelEventSource.ShowPII = true; app.UseDeveloperExceptionPage(); app.UseOpenApi(); } @@ -113,11 +114,12 @@ namespace Giants.Web app.UseAuthentication(); app.UseAuthorization(); - app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); + + app.MapHealthChecks("/health"); } } }