Files
Luna/Luna.Configuration/Extensions/ConfigurationBuilderExtensions.cs
T
darman a4ed65e452 Add Luna.Configuration with TOML-based agent and provider config
Implement configuration system with embedded TOML resources for agent
and provider definitions, custom IConfigurationSource/Provider for
agent and provider options, and DI extension methods. Includes config
models for agents, providers, sessions, and Telegram integration.
2026-04-04 04:09:57 +02:00

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 string[] AgentConfigSearchPaths =
[
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".luna", "agents")
];
private static 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;
}
}
}