/// <inheritdoc/> protected override void ConfigureWebHost(IWebHostBuilder builder) { // Specify the startup command line options var commandLineOpts = new StartupOptions { NoWebClient = true, NoAutoRunWebApp = true }; // Use a temporary directory for the application paths var webHostPathRoot = Path.Combine(_testPathRoot, "test-host-" + Path.GetFileNameWithoutExtension(Path.GetRandomFileName())); Directory.CreateDirectory(Path.Combine(webHostPathRoot, "logs")); Directory.CreateDirectory(Path.Combine(webHostPathRoot, "config")); Directory.CreateDirectory(Path.Combine(webHostPathRoot, "cache")); Directory.CreateDirectory(Path.Combine(webHostPathRoot, "jellyfin-web")); var appPaths = new ServerApplicationPaths( webHostPathRoot, Path.Combine(webHostPathRoot, "logs"), Path.Combine(webHostPathRoot, "config"), Path.Combine(webHostPathRoot, "cache"), Path.Combine(webHostPathRoot, "jellyfin-web")); // Create the logging config file // TODO: We shouldn't need to do this since we are only logging to console Program.InitLoggingConfigFile(appPaths).GetAwaiter().GetResult(); // Create a copy of the application configuration to use for startup var startupConfig = Program.CreateAppConfiguration(commandLineOpts, appPaths); ILoggerFactory loggerFactory = new SerilogLoggerFactory(); var serviceCollection = new ServiceCollection(); _disposableComponents.Add(loggerFactory); // Create the app host and initialize it var appHost = new CoreAppHost( appPaths, loggerFactory, commandLineOpts, new ManagedFileSystem(loggerFactory.CreateLogger <ManagedFileSystem>(), appPaths), new NetworkManager(loggerFactory.CreateLogger <NetworkManager>()), serviceCollection); _disposableComponents.Add(appHost); appHost.Init(); // Configure the web host builder Program.ConfigureWebHostBuilder(builder, appHost, serviceCollection, commandLineOpts, startupConfig, appPaths); }