Set the content root to the application folder

https://github.com/Jackett/Jackett/issues/3522
This commit is contained in:
flightlevel
2018-08-04 16:49:26 +10:00
parent 9ca4600eab
commit f00d8e192a

View File

@@ -14,6 +14,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Jackett.Server namespace Jackett.Server
@@ -130,7 +131,10 @@ namespace Jackett.Server
try try
{ {
logger.Debug("Creating web host..."); logger.Debug("Creating web host...");
CreateWebHostBuilder(args, url).Build().Run(); string applicationFolder = configurationService.ApplicationFolder();
logger.Debug($"Content root path is: {applicationFolder}");
CreateWebHostBuilder(args, url, applicationFolder).Build().Run();
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -174,9 +178,10 @@ namespace Jackett.Server
} }
} }
public static IWebHostBuilder CreateWebHostBuilder(string[] args, string[] urls) => public static IWebHostBuilder CreateWebHostBuilder(string[] args, string[] urls, string contentRoot) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.UseConfiguration(Configuration) .UseConfiguration(Configuration)
.UseContentRoot(contentRoot)
.UseUrls(urls) .UseUrls(urls)
.PreferHostingUrls(true) .PreferHostingUrls(true)
.UseStartup<Startup>() .UseStartup<Startup>()