mirror of
https://github.com/Readarr/Readarr
synced 2026-01-04 22:54:24 +01:00
parent
ef20abba7a
commit
d93329a3fd
1 changed files with 19 additions and 6 deletions
|
|
@ -14,6 +14,7 @@
|
|||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Hosting.WindowsServices;
|
||||
using NLog;
|
||||
using Npgsql;
|
||||
using NzbDrone.Common.Composition.Extensions;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
|
@ -55,6 +56,7 @@ public static void Start(string[] args, Action<IHostBuilder> trayCallback = null
|
|||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
|
||||
var appMode = GetApplicationMode(startupContext);
|
||||
var config = GetConfiguration(startupContext);
|
||||
|
||||
switch (appMode)
|
||||
{
|
||||
|
|
@ -83,12 +85,22 @@ public static void Start(string[] args, Action<IHostBuilder> trayCallback = null
|
|||
// Utility mode
|
||||
default:
|
||||
{
|
||||
new Container(rules => rules.WithNzbDroneRules())
|
||||
.AutoAddServices(ASSEMBLIES)
|
||||
.AddNzbDroneLogger()
|
||||
.AddStartupContext(startupContext)
|
||||
.Resolve<UtilityModeRouter>()
|
||||
.Route(appMode);
|
||||
new HostBuilder()
|
||||
.UseServiceProviderFactory(new DryIocServiceProviderFactory(new Container(rules => rules.WithNzbDroneRules())))
|
||||
.ConfigureContainer<IContainer>(c =>
|
||||
{
|
||||
c.AutoAddServices(Bootstrap.ASSEMBLIES)
|
||||
.AddNzbDroneLogger()
|
||||
.AddDatabase()
|
||||
.AddStartupContext(startupContext)
|
||||
.Resolve<UtilityModeRouter>()
|
||||
.Route(appMode);
|
||||
})
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.Configure<PostgresOptions>(config.GetSection("Readarr:Postgres"));
|
||||
}).Build();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -111,6 +123,7 @@ public static void Start(string[] args, Action<IHostBuilder> trayCallback = null
|
|||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
SQLiteConnection.ClearAllPools();
|
||||
NpgsqlConnection.ClearAllPools();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateConsoleHostBuilder(string[] args, StartupContext context)
|
||||
|
|
|
|||
Loading…
Reference in a new issue