Add view to display current configuration in WebStatus
This commit is contained in:
		
							parent
							
								
									038b3caffa
								
							
						
					
					
						commit
						17ab5170f1
					
				@ -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
									
								
								src/Web/WebStatus/Views/Home/Config.cshtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/Web/WebStatus/Views/Home/Config.cshtml
									
									
									
									
									
										Normal 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>
 | 
			
		||||
@ -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" />
 | 
			
		||||
 | 
			
		||||
@ -34,7 +34,7 @@
 | 
			
		||||
        "Uri": "http://localhost:5108/hc"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "Name": "WebMVC HTTP Check",
 | 
			
		||||
        "Name": "WebMVC HTTP Check (settings-dev)",
 | 
			
		||||
        "Uri": "http://localhost:5100/hc"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
 | 
			
		||||
@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user