40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using Luna.Configuration.Services.Agents;
|
|
using Luna.Configuration.Services.Providers;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace Luna.Configuration.Extensions;
|
|
|
|
public static class ConfigurationBuilderExtensions
|
|
{
|
|
private static readonly string[] AgentConfigSearchPaths =
|
|
[
|
|
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".luna", "agents")
|
|
];
|
|
|
|
private static readonly string[] ProviderConfigSearchPaths =
|
|
[
|
|
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".luna", "providers")
|
|
];
|
|
|
|
extension(IConfigurationBuilder builder)
|
|
{
|
|
public IConfigurationBuilder AddLunaConfiguration()
|
|
{
|
|
builder.Add(new AgentOptionsConfigurationSource());
|
|
|
|
foreach (var searchPath in AgentConfigSearchPaths)
|
|
{
|
|
builder.Add(new AgentOptionsConfigurationSource(searchPath));
|
|
}
|
|
|
|
builder.Add(new ProviderOptionsConfigurationSource());
|
|
|
|
foreach (var searchPath in ProviderConfigSearchPaths)
|
|
{
|
|
builder.Add(new ProviderOptionsConfigurationSource(searchPath));
|
|
}
|
|
|
|
return builder;
|
|
}
|
|
}
|
|
} |