fix: add test env to variablesFromFile

This commit is contained in:
Polianin Nikita 2024-07-05 01:22:21 +03:00
parent cdb738ca42
commit 57f4d1b822

View File

@ -46,6 +46,10 @@ public static class EnvironmentConfiguration
{ {
var variablesFromFile = LoadEnvironment(".env"); var variablesFromFile = LoadEnvironment(".env");
#if DEBUG
LoadEnvironment(".env.develop").ToList().ForEach(x => variablesFromFile.Add(x.Key, x.Value));
#endif
var environmentVariables = Environment.GetEnvironmentVariables() var environmentVariables = Environment.GetEnvironmentVariables()
.OfType<DictionaryEntry>() .OfType<DictionaryEntry>()
.ToDictionary( .ToDictionary(
@ -57,9 +61,8 @@ public static class EnvironmentConfiguration
.AddInMemoryCollection(environmentVariables!) .AddInMemoryCollection(environmentVariables!)
.AddInMemoryCollection(variablesFromFile!); .AddInMemoryCollection(variablesFromFile!);
#if DEBUG
result.AddInMemoryCollection(LoadEnvironment(".env.develop")!);
#endif
if (!variablesFromFile.TryGetValue("PATH_TO_SAVE", out var data)) if (!variablesFromFile.TryGetValue("PATH_TO_SAVE", out var data))
return result.Build(); return result.Build();