You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace ZeroLevel.Services.Config.Implementation
|
|
|
|
|
{
|
|
|
|
|
internal sealed class EnvironmentVariablesConfigReader
|
|
|
|
|
: IConfigurationReader
|
|
|
|
|
{
|
|
|
|
|
public IConfiguration ReadConfiguration()
|
|
|
|
|
{
|
|
|
|
|
var result = Configuration.Create();
|
|
|
|
|
var enumerator = Environment.GetEnvironmentVariables().GetEnumerator();
|
|
|
|
|
while (enumerator.MoveNext())
|
|
|
|
|
{
|
|
|
|
|
string key = (string)enumerator.Entry.Key;
|
|
|
|
|
string value = ((string?)enumerator.Entry.Value) ?? string.Empty;
|
|
|
|
|
result.Append(key, value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IConfigurationSet ReadConfigurationSet()
|
|
|
|
|
{
|
|
|
|
|
return Configuration.CreateSet(ReadConfiguration());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|