Updated
This commit is contained in:
1
EnvTester/EnvTester/.env
Normal file
1
EnvTester/EnvTester/.env
Normal file
@@ -0,0 +1 @@
|
||||
nummer4=TEST
|
@@ -9,7 +9,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="EonaCat.Env">
|
||||
<HintPath>..\..\..\EonaCat.Env\EonaCat.Env\bin\Debug\netstandard2.1\EonaCat.Env.dll</HintPath>
|
||||
<HintPath>..\..\..\EonaCat.Env\EonaCat.Env\bin\Debug\net6.0\EonaCat.Env.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -1,13 +1,32 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
using EonaCat.Env;
|
||||
using EonaCat.Env.Helpers;
|
||||
using System.Diagnostics.Metrics;
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
||||
Env.LoadIntoEnvironment();
|
||||
Env.LoadIntoEnvironment(new Settings(traverseDirectories:true));
|
||||
var test = Env.Read(new Settings(traverseDirectories:true));
|
||||
Getter.SwallowExceptions = false;
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("nummer4"));
|
||||
Console.WriteLine(Getter.GetString("nummer4"));
|
||||
if (test.Any())
|
||||
Console.WriteLine("From Env.Read: " + test.Values);
|
||||
Console.WriteLine("From Environment variable: " + Environment.GetEnvironmentVariable("nummer4"));
|
||||
Console.WriteLine("From Getter: " + Getter.GetValue<string>("nummer4"));
|
||||
Console.WriteLine("From SecretManager class: " + Secrets.API_KEY);
|
||||
Console.WriteLine("+------+");
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("FAAL"));
|
||||
Console.WriteLine("test");
|
||||
Console.WriteLine("test");
|
||||
|
||||
public static class Secrets
|
||||
{
|
||||
static Secrets()
|
||||
{
|
||||
Env.LoadIntoEnvironment(new Settings(traverseDirectories: true));
|
||||
}
|
||||
|
||||
public static string API_KEY => GetApiKey();
|
||||
|
||||
private static string GetApiKey()
|
||||
{
|
||||
return Getter.GetValue<string>("nummer4");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user