From 8cc5d1d55e2e55a70b1f8bd13588b0f2c0e93297 Mon Sep 17 00:00:00 2001 From: sztrelcsikzoltan Date: Mon, 3 Jul 2023 22:55:32 +0200 Subject: [PATCH] Create Liveness health check - for the endpoint /health --- InvestmentManager/InvestmentManager/Program.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/InvestmentManager/InvestmentManager/Program.cs b/InvestmentManager/InvestmentManager/Program.cs index a44ae5e..2027efe 100644 --- a/InvestmentManager/InvestmentManager/Program.cs +++ b/InvestmentManager/InvestmentManager/Program.cs @@ -50,6 +50,10 @@ builder.Services.AddStockIndexServiceHttpClientWithoutProfiler(stockIndexServiceUrl); builder.Services.AddInvestmentManagerServices(stockIndexServiceUrl); +// Liveness healh check +builder.Services.AddHealthChecks(); + + var app = builder.Build(); // Configure the HTTP request pipeline. @@ -68,6 +72,9 @@ app.UseAuthorization(); +// Configure Liveness health check +app.UseEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); }); + app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");