summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/IOL.VippsEcommerce/IOL.VippsEcommerce.csproj2
-rw-r--r--src/IOL.VippsEcommerce/Models/VippsConfiguration.cs6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/IOL.VippsEcommerce/IOL.VippsEcommerce.csproj b/src/IOL.VippsEcommerce/IOL.VippsEcommerce.csproj
index 711ff84..1097744 100644
--- a/src/IOL.VippsEcommerce/IOL.VippsEcommerce.csproj
+++ b/src/IOL.VippsEcommerce/IOL.VippsEcommerce.csproj
@@ -16,6 +16,8 @@
</PropertyGroup>
<ItemGroup>
+ <PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
diff --git a/src/IOL.VippsEcommerce/Models/VippsConfiguration.cs b/src/IOL.VippsEcommerce/Models/VippsConfiguration.cs
index 584ff2b..c9d9b1e 100644
--- a/src/IOL.VippsEcommerce/Models/VippsConfiguration.cs
+++ b/src/IOL.VippsEcommerce/Models/VippsConfiguration.cs
@@ -1,4 +1,5 @@
using System;
+using Microsoft.Extensions.Configuration;
namespace IOL.VippsEcommerce.Models
{
@@ -151,13 +152,14 @@ namespace IOL.VippsEcommerce.Models
}
private string GetValueFromEnvironment(string key) {
+ var config = new ConfigurationBuilder().AddEnvironmentVariables().Build();
#if DEBUG
- var value = Environment.GetEnvironmentVariable(key);
+ var value = config[key];
Console.WriteLine("Getting VippsConfiguration value for " + key + " from environment.");
Console.WriteLine("Key: " + key + " Value: " + value);
return value;
#else
- return Environment.GetEnvironmentVariable(key);
+ return config[key];
#endif
}