EnvDotNet 1.0.2

dotnet add package EnvDotNet --version 1.0.2
NuGet\Install-Package EnvDotNet -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EnvDotNet" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EnvDotNet --version 1.0.2
#r "nuget: EnvDotNet, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EnvDotNet as a Cake Addin
#addin nuget:?package=EnvDotNet&version=1.0.2

// Install EnvDotNet as a Cake Tool
#tool nuget:?package=EnvDotNet&version=1.0.2

EnvDotNet

Build Unit Tests codecov DeepSource

Env.Net is a simple library to read environment variables from config files.

Usage

First, structure your env file like so:

key1=value1
key2=value2

Then, you can read the environment variables like so:

using EnvDotNet;

Env.Init(); // Env.Init() loads the env file and makes it available globally. The method defaults to using .env as the file name, but can take a string parameter to specify the file name.
string key1 = Env.Get("key1");

Env.Net has numerous other features, such as:

Using multiple env files

Env file1 = new Env("file1.env");
Env file2 = new Env("file2.env");

string key1 = file1["key1"];
string key2 = file2["key2"];

Using default values

Env.Init();
string key = Env.Get("key", "default");

Contains Key

Env.Init();
Env local = new Env("local.env");
bool containsKey = Env.ContainsKey("key");
bool containsLocalKey = local.Contains("key");
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 72 3/13/2024
1.0.1 65 3/13/2024
1.0.0 77 3/13/2024