Skip to content

Simple support to load environment variables from .env file to system level for .NET 8.

License

Notifications You must be signed in to change notification settings

notfrancois/dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotenv | A simple .env loader for .NET 8

NuGet

Description

dotenv provides simple support for loading environment variables from a .env file to the system level for .NET 8 applications. It helps manage sensitive configurations and enhances application portability.

Features

  • Automatic loading of environment variables from a .env file.
  • Compatible with .NET 8.
  • Easy integration into existing projects.

Installation

To install dotenv, add the package to your project using NuGet:

dotnet add package PiscesMetadata.EnvironmentVariables
using Microsoft.Extensions.Hosting;

public class Program
{
    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .WithEnvironmentVariables()
            .ConfigureServices((hostContext, services) =>
            {
                // Configure your services here
            });
}

.env File

Create a file named .env in the root of your project and define your environment variables in the following format:

DATABASE_URL=your_database_url
API_KEY=your_api_key

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributions

Contributions are welcome. If you would like to contribute, please open an issue or submit a pull request.

Contact

For more information, contact François López at here.

About

Simple support to load environment variables from .env file to system level for .NET 8.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages