Update
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user