Skip to content

merttumer/Environmental

Repository files navigation

Environmental is a mapper that maps envrionment variables/files to classes

Example:

[Environmental]
class TestClass
{
    [Env(Name = "test_int", Required = true)]
    public int SomeInt { get; set; }
    [Env(Name = "test_float", Required = true)]
    public float SomeFloat { get; set; }
    [Env(Name = "test_double", Required = true)]
    public double SomeDouble { get; set; }
    [Env(Name = "test_string", Required = true)]
    public string? SomeString { get; set; }
    [Env(Name = "test_bool", Required = true)]
    public bool SomeBool { get; set; }
    [Env(Name = "test_date", Required = false)]
    public DateTime SomeDateTime { get; set; }
    [Env(Name = "test_timespan", Required = true)]
    public TimeSpan SomeTimeSpan { get; set; }
}

load from system environment directly

var t = EnvMapper.Map<TestClass>();

or from .env file

TestClass t = EnvMapper.Map<TestClass>("test.env");

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published