Files
HomeAssistant/LeakMonitor.Manager/LeakMonitorServiceRegistration.cs
T
2026-06-28 13:58:35 +03:00

29 lines
809 B
C#

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NetDaemon.AppModel;
using LeakMonitorManager.Interface;
using LeakMonitorManager.Models;
namespace LeakMonitorManager;
public static class LeakMonitorServiceRegistration
{
public static IServiceCollection AddLeakMonitor(this IServiceCollection services, IConfiguration configuration)
{
var options = configuration
.GetSection(LeakMonitorOptions.SectionName)
.Get<LeakMonitorOptions>() ?? new LeakMonitorOptions();
if (!options.Enabled)
{
return services;
}
services
.AddNetDaemonApp<LeakMonitorInit>()
.AddScoped<ILeakNotificationService, LeakNotificationService>();
return services;
}
}