Browse Source

Add view to display current configuration in WebStatus

pull/1137/head
Miguel Veloso 5 years ago
parent
commit
17ab5170f1
5 changed files with 37 additions and 3 deletions
  1. +17
    -1
      src/Web/WebStatus/Controllers/HomeController.cs
  2. +17
    -0
      src/Web/WebStatus/Views/Home/Config.cshtml
  3. +1
    -0
      src/Web/WebStatus/WebStatus.csproj
  4. +1
    -1
      src/Web/WebStatus/appsettings.Development.json
  5. +1
    -1
      src/Web/WebStatus/appsettings.json

+ 17
- 1
src/Web/WebStatus/Controllers/HomeController.cs View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using HealthChecks.UI.Configuration;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using System.Linq;
using System.Threading.Tasks;
namespace WebStatus.Controllers
@ -19,6 +21,20 @@ namespace WebStatus.Controllers
return Redirect($"{basePath}/hc-ui");
}
[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);
}
public IActionResult Error()
{
return View();


+ 17
- 0
src/Web/WebStatus/Views/Home/Config.cshtml View File

@ -0,0 +1,17 @@
@model Dictionary<string, string>
@{
ViewData["Title"] = "WebStatus Configuration";
}
<h1>Configuration Values</h1>
<table>
@foreach (var item in Model)
{
<tr>
<td>@item.Key</td>
<td>@item.Value</td>
</tr>
}
</table>

+ 1
- 0
src/Web/WebStatus/WebStatus.csproj View File

@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="1.0.172" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />


+ 1
- 1
src/Web/WebStatus/appsettings.Development.json View File

@ -34,7 +34,7 @@
"Uri": "http://localhost:5108/hc"
},
{
"Name": "WebMVC HTTP Check",
"Name": "WebMVC HTTP Check (settings-dev)",
"Uri": "http://localhost:5100/hc"
},
{


+ 1
- 1
src/Web/WebStatus/appsettings.json View File

@ -34,7 +34,7 @@
"Uri": "http://localhost:5108/hc"
},
{
"Name": "WebMVC HTTP Check",
"Name": "WebMVC HTTP Check (settings-prod)",
"Uri": "http://localhost:5100/hc"
},
{


Loading…
Cancel
Save