2020-12-19 09:18:36 +05:30
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2019-01-03 17:11:56 +01:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2019-08-16 19:57:22 +01:00
|
|
|
|
using System.Linq;
|
2017-03-23 19:10:55 +01:00
|
|
|
|
|
|
|
|
|
namespace WebStatus.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
2019-01-03 17:11:56 +01:00
|
|
|
|
private IConfiguration _configuration;
|
|
|
|
|
|
|
|
|
|
public HomeController(IConfiguration configuration)
|
2017-03-23 19:10:55 +01:00
|
|
|
|
{
|
2019-01-03 17:11:56 +01:00
|
|
|
|
_configuration = configuration;
|
2017-03-23 19:10:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-30 17:43:22 +01:00
|
|
|
|
public IActionResult Index()
|
2017-03-23 19:10:55 +01:00
|
|
|
|
{
|
2019-01-03 17:11:56 +01:00
|
|
|
|
var basePath = _configuration["PATH_BASE"];
|
|
|
|
|
return Redirect($"{basePath}/hc-ui");
|
2017-03-23 19:10:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-16 19:57:22 +01:00
|
|
|
|
[HttpGet("/Config")]
|
|
|
|
|
public IActionResult Config()
|
|
|
|
|
{
|
|
|
|
|
var configurationValues = _configuration.GetSection("HealthChecksUI:HealthChecks")
|
|
|
|
|
.GetChildren()
|
|
|
|
|
.SelectMany(cs => cs.GetChildren())
|
|
|
|
|
.Union(_configuration.GetSection("HealthChecks-UI:HealthChecks")
|
|
|
|
|
.GetChildren()
|
|
|
|
|
.SelectMany(cs => cs.GetChildren()))
|
|
|
|
|
.ToDictionary(v => v.Path, v => v.Value);
|
|
|
|
|
|
|
|
|
|
return View(configurationValues);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 19:10:55 +01:00
|
|
|
|
public IActionResult Error()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|