// 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(new Settings(traverseDirectories:true));
var test = Env.Read(new Settings(traverseDirectories:true));
Getter.SwallowExceptions = false;
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");

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");
    }
}