Inject IStartupOptions into StartupWizard

pull/2765/head
Mark Monteiro 5 years ago
parent 809cf3a0c2
commit 241d0ae65c

@ -557,6 +557,8 @@ namespace Emby.Server.Implementations
: typeof(NullImageEncoder);
serviceCollection.AddSingleton(typeof(IImageEncoder), imageEncoderType);
serviceCollection.AddSingleton(_startupOptions);
serviceCollection.AddMemoryCache();
serviceCollection.AddSingleton(ConfigurationManager);

@ -16,17 +16,25 @@ namespace Emby.Server.Implementations.EntryPoints
private readonly IServerApplicationHost _appHost;
private readonly IConfiguration _appConfig;
private readonly IServerConfigurationManager _config;
private readonly IStartupOptions _startupOptions;
/// <summary>
/// Initializes a new instance of the <see cref="StartupWizard"/> class.
/// </summary>
/// <param name="appHost">The application host.</param>
/// <param name="appConfig">The application configuration.</param>
/// <param name="config">The configuration manager.</param>
public StartupWizard(IServerApplicationHost appHost, IConfiguration appConfig, IServerConfigurationManager config)
/// <param name="startupOptions">The application startup options.</param>
public StartupWizard(
IServerApplicationHost appHost,
IConfiguration appConfig,
IServerConfigurationManager config,
IStartupOptions startupOptions)
{
_appHost = appHost;
_appConfig = appConfig;
_config = config;
_startupOptions = startupOptions;
}
/// <inheritdoc />
@ -47,9 +55,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
else if (_config.Configuration.AutoRunWebApp)
{
var options = ((ApplicationHost)_appHost).StartupOptions;
if (!options.NoAutoRunWebApp)
if (!_startupOptions.NoAutoRunWebApp)
{
BrowserLauncher.OpenWebApp(_appHost);
}

Loading…
Cancel
Save