Created
May 1, 2019 20:13
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
using AwsSecretStoreAspNetCore.Models; | |
using Microsoft.Extensions.Configuration; | |
using AwsSecretStoreAspNetCore.Models.Home; | |
namespace AwsSecretStoreAspNetCore.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
private readonly IConfiguration _config; | |
public HomeController(IConfiguration config) | |
{ | |
_config = config; | |
} | |
public IActionResult Index() | |
{ | |
var vm = new IndexViewModel | |
{ | |
Secret = _config.GetValue<string>("test:ConnectionStrings:DATABASE"), | |
}; | |
return View(vm); | |
} | |
public IActionResult Privacy() | |
{ | |
return View(); | |
} | |
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] | |
public IActionResult Error() | |
{ | |
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
ViewData["Title"] = "Home Page"; | |
} | |
<div class="text-center"> | |
<h1 class="display-4">Welcome</h1> | |
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p> | |
<p>Secret: @Model.Secret</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace AwsSecretStoreAspNetCore.Models.Home | |
{ | |
public class IndexViewModel | |
{ | |
public string Secret { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment