From c42786472a206f8dfa6c5414be5e17171c2b626f Mon Sep 17 00:00:00 2001 From: BobC Date: Mon, 11 May 2020 19:09:50 -0400 Subject: [PATCH] complete thru exercise 1 --- Controllers/ConfigurationController.cs | 15 +++++++++++---- IGAS.csproj | 1 + appsettings.Development.json | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Controllers/ConfigurationController.cs b/Controllers/ConfigurationController.cs index 805d7d9..a2766ba 100644 --- a/Controllers/ConfigurationController.cs +++ b/Controllers/ConfigurationController.cs @@ -16,13 +16,20 @@ public ConfigurationController(IConfiguration config) { _config = config; } - [HttpGet] public IEnumerable Get() { - return new string[] { - $"Testing, Hello World!" - }; + // replace from here... + string envVar = _config.GetValue("TMP") ?? "NOT SET"; + string userSecret = _config.GetValue("MyUserSecret") ?? "NOT SET"; + string appSetting = _config.GetValue("FromAppSettings") ?? "NOT SET"; + + return new string[] { + $"Environment Variable TMP = {envVar}", + $"User Secret MyUserSecret = {userSecret}", + $"App Setting FromAppSettings = {appSetting}" + }; + // .. to here } } } diff --git a/IGAS.csproj b/IGAS.csproj index 5f61918..1c3b2b9 100644 --- a/IGAS.csproj +++ b/IGAS.csproj @@ -2,5 +2,6 @@ netcoreapp3.1 + b803b553-0d4b-4fc4-846a-601ee4f8327c \ No newline at end of file diff --git a/appsettings.Development.json b/appsettings.Development.json index 1797133..b42918e 100644 --- a/appsettings.Development.json +++ b/appsettings.Development.json @@ -1,3 +1,3 @@ { - -} + "FromAppSettings": "I came from appsettings." +} \ No newline at end of file