From 82b9d9c2075a16d7efa022d7f752d6e153b69d20 Mon Sep 17 00:00:00 2001 From: Jim Vacca <33520581+MSFTJim@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:52:27 +0000 Subject: [PATCH] chore: Update Index.cshtml to include environment information --- frontend/Pages/Index.cshtml | 8 ++++++-- frontend/Pages/Index.cshtml.cs | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/frontend/Pages/Index.cshtml b/frontend/Pages/Index.cshtml index 5858671..63a4755 100644 --- a/frontend/Pages/Index.cshtml +++ b/frontend/Pages/Index.cshtml @@ -12,8 +12,12 @@ -
Environment is Development
+
Environment is Development
+ -
Environment is NOT Development
+
Environment is NOT Development
+ +
Environment: @Model.envEnvironment
+
API Url: @Model.envAPIProductionUrl
diff --git a/frontend/Pages/Index.cshtml.cs b/frontend/Pages/Index.cshtml.cs index 9ffcb48..1bdc249 100644 --- a/frontend/Pages/Index.cshtml.cs +++ b/frontend/Pages/Index.cshtml.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; namespace frontend.Pages @@ -11,14 +12,20 @@ namespace frontend.Pages public class IndexModel : PageModel { private readonly ILogger _logger; + private readonly IConfiguration _config; + public string envEnvironment { get; set; } + public string envAPIProductionUrl { get; set; } - public IndexModel(ILogger logger) + public IndexModel(ILogger logger, IConfiguration config) { _logger = logger; + _config = config; } public void OnGet() { + envEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + envAPIProductionUrl = _config["APIProductionUrl"]; } }