You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/NzbDrone/NzbDroneBootstrapper.cs

50 lines
1.3 KiB

using System.Reflection;
using Autofac;
using NLog;
using NzbDrone.Api;
using NzbDrone.Common;
using NzbDrone.Core.Instrumentation;
namespace NzbDrone
{
12 years ago
public static class NzbDroneBootstrapper
{
private static readonly IContainer container;
12 years ago
private static readonly Logger logger = LogManager.GetLogger("NzbDroneBootstrapper");
12 years ago
static NzbDroneBootstrapper()
{
var builder = new ContainerBuilder();
BindKernel(builder);
container = builder.Build();
InitializeApp();
}
public static IContainer Container
{
get
{
return container;
}
}
private static void BindKernel(ContainerBuilder builder)
{
builder.RegisterModule<LogInjectionModule>();
builder.RegisterCommonServices();
builder.RegisterApiServices();
builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly());
}
private static void InitializeApp()
{
var environmentProvider = container.Resolve<EnvironmentProvider>();
ReportingService.RestProvider = container.Resolve<RestProvider>();
logger.Info("Start-up Path:'{0}'", environmentProvider.ApplicationPath);
}
}
}