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.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Luna.Configuration.Services.Agents;
|
||||
|
||||
internal class AgentOptionsConfigurationProvider(IEnumerable<AgentOptions> agentOptions) : ConfigurationProvider
|
||||
{
|
||||
public override void Load()
|
||||
{
|
||||
foreach (var options in agentOptions)
|
||||
{
|
||||
var keyPrefix = $"Agents:{options.Name}";
|
||||
|
||||
foreach (var property in options.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
|
||||
{
|
||||
Data[$"{keyPrefix}:{property.Name}"] = property.GetValue(options)?.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user