diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b95db9..d191187 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,8 @@ -version: 2.0 +version: 2.1 jobs: build: docker: - - image: mcr.microsoft.com/dotnet/sdk:3.1 + - image: mcr.microsoft.com/dotnet/sdk:5.0 steps: - checkout - run: @@ -28,7 +28,7 @@ jobs: - run: name: Install Coveralls command: - dotnet tool install coveralls.net --version 2.0.0 --tool-path tools + dotnet tool install coveralls.net --version 3.0.0 --tool-path tools - run: name: Report Coverage command: diff --git a/src/dotenv.net.DependencyInjection.Autofac/dotenv.net.DependencyInjection.Autofac.csproj b/src/dotenv.net.DependencyInjection.Autofac/dotenv.net.DependencyInjection.Autofac.csproj index 1d3c387..dd7f3c6 100644 --- a/src/dotenv.net.DependencyInjection.Autofac/dotenv.net.DependencyInjection.Autofac.csproj +++ b/src/dotenv.net.DependencyInjection.Autofac/dotenv.net.DependencyInjection.Autofac.csproj @@ -1,7 +1,7 @@ - 2.1.3 + 3.0.0 dotenv.net.DependencyInjection.Autofac Winner-Timothy Bolorunduro Adds DI support for values read from the environment for Autofac @@ -12,11 +12,11 @@ git autofac, dotenv, net core - initial release - 2.1.3 + 3.0.0 true Copyright 2021 - netstandard1.6;netstandard2.0;netstandard2.1 - 2.1.3 + net5.0;net5.0-windows;netstandard1.6;netstandard2.0;netstandard2.1 + 3.0.0 en-NG @@ -35,4 +35,12 @@ + + + + + + + + diff --git a/src/dotenv.net.DependencyInjection.Microsoft/dotenv.net.DependencyInjection.Microsoft.csproj b/src/dotenv.net.DependencyInjection.Microsoft/dotenv.net.DependencyInjection.Microsoft.csproj index f6d3f2c..30d70bc 100644 --- a/src/dotenv.net.DependencyInjection.Microsoft/dotenv.net.DependencyInjection.Microsoft.csproj +++ b/src/dotenv.net.DependencyInjection.Microsoft/dotenv.net.DependencyInjection.Microsoft.csproj @@ -2,7 +2,7 @@ true - 2.1.3 + 3.0.0 dotenv.net.DependencyInjection.Microsoft Winner-Timothy Bolorunduro Adds DI support for values read from the environment for Microsoft Service Collection @@ -14,9 +14,9 @@ git service collection, dotenv - bump support - netstandard1.6;netstandard2.0;netstandard2.1 - 2.1.3 - 2.1.3 + net5.0;net5.0-windows;netstandard1.6;netstandard2.0;netstandard2.1 + 3.0.0 + 3.0.0 en-NG @@ -35,4 +35,12 @@ + + + + + + + + diff --git a/src/dotenv.net/DotEnv.cs b/src/dotenv.net/DotEnv.cs index 446424a..e48a375 100644 --- a/src/dotenv.net/DotEnv.cs +++ b/src/dotenv.net/DotEnv.cs @@ -1,5 +1,7 @@ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using dotenv.net.DependencyInjection.Infrastructure; @@ -70,5 +72,34 @@ public static bool AutoConfig(int levelsToSearch = 4) return false; } + + /// + /// Load the values in the provided env file into the environment variables + /// + /// The path to the .env file to be read + /// The encoding that the env file was saved in + /// Determines if an exception should be thrown or swallowed + public static void Load(string envFilePath = DefaultEnvFileName, Encoding encoding = null, + bool ignoreExceptions = true) + { + ConfigRunner(ignoreExceptions, envFilePath, encoding, true); + } + + /// + /// Load the values in the provided env files into the environment variables + /// + /// The paths to the .env files to be read + /// The encoding that the env file was saved in + /// Determines if an exception should be thrown or swallowed + public static void Load(IEnumerable envFilePaths = null, Encoding encoding = null, + bool ignoreExceptions = true) + { + envFilePaths ??= Enumerable.Empty(); + + foreach (var envFilePath in envFilePaths) + { + ConfigRunner(ignoreExceptions, envFilePath, encoding, true); + } + } } } \ No newline at end of file diff --git a/src/dotenv.net/dotenv.net.csproj b/src/dotenv.net/dotenv.net.csproj index ab499fa..b92fc6c 100644 --- a/src/dotenv.net/dotenv.net.csproj +++ b/src/dotenv.net/dotenv.net.csproj @@ -11,14 +11,14 @@ https://github.com/bolorundurowb/dotenv.net/blob/master/LICENSE https://github.com/bolorundurowb/dotenv.net default - 2.1.3 + 3.0.0 git dotnet, environment, variables, env, dotenv, net core, autofac true - 2.1.3 - 2.1.3 + 3.0.0 + 3.0.0 en-NG - netstandard1.6;netstandard2.0;netstandard2.1 + net5.0;net5.0-windows;netstandard1.6;netstandard2.0;netstandard2.1 dotenv.net diff --git a/tests/dotenv.net.DependencyInjection.Autofac.Tests/dotenv.net.DependencyInjection.Autofac.Tests.csproj b/tests/dotenv.net.DependencyInjection.Autofac.Tests/dotenv.net.DependencyInjection.Autofac.Tests.csproj index 77e2620..eff3e32 100644 --- a/tests/dotenv.net.DependencyInjection.Autofac.Tests/dotenv.net.DependencyInjection.Autofac.Tests.csproj +++ b/tests/dotenv.net.DependencyInjection.Autofac.Tests/dotenv.net.DependencyInjection.Autofac.Tests.csproj @@ -1,7 +1,7 @@ Exe - netcoreapp3.1 + net5.0 diff --git a/tests/dotenv.net.DependencyInjection.Microsoft.Tests/dotenv.net.DependencyInjection.Microsoft.Tests.csproj b/tests/dotenv.net.DependencyInjection.Microsoft.Tests/dotenv.net.DependencyInjection.Microsoft.Tests.csproj index bbe8340..4c4b386 100644 --- a/tests/dotenv.net.DependencyInjection.Microsoft.Tests/dotenv.net.DependencyInjection.Microsoft.Tests.csproj +++ b/tests/dotenv.net.DependencyInjection.Microsoft.Tests/dotenv.net.DependencyInjection.Microsoft.Tests.csproj @@ -1,7 +1,7 @@ Exe - netcoreapp3.1 + net5.0 diff --git a/tests/dotenv.net.Tests/dotenv.net.Tests.csproj b/tests/dotenv.net.Tests/dotenv.net.Tests.csproj index 6a43b73..c28598e 100644 --- a/tests/dotenv.net.Tests/dotenv.net.Tests.csproj +++ b/tests/dotenv.net.Tests/dotenv.net.Tests.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net5.0 false 1.0.6