Skip to content

Commit

Permalink
Merge pull request #89 from pappyangel/SQLInjection
Browse files Browse the repository at this point in the history
chore: Update Index.cshtml to include environment information
  • Loading branch information
timrobertsusa authored Aug 9, 2024
2 parents 2ab56c9 + 82b9d9c commit 5f916a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions frontend/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
</div>

<environment include="Development">
<div>Environment is Development</div>
<div>Environment is Development</div>
</environment>

<environment exclude="Development">
<div>Environment is NOT Development</div>
<div>Environment is NOT Development</div>
</environment>

<div> Environment: @Model.envEnvironment </div>
<div> API Url: @Model.envAPIProductionUrl </div>
9 changes: 8 additions & 1 deletion frontend/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,28 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace frontend.Pages
{
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly IConfiguration _config;
public string envEnvironment { get; set; }
public string envAPIProductionUrl { get; set; }

public IndexModel(ILogger<IndexModel> logger)
public IndexModel(ILogger<IndexModel> logger, IConfiguration config)
{
_logger = logger;
_config = config;
}

public void OnGet()
{
envEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
envAPIProductionUrl = _config["APIProductionUrl"];

}
}
Expand Down

0 comments on commit 5f916a2

Please sign in to comment.