Inject IStartupOptions into StartupWizard

This commit is contained in:
Mark Monteiro 2020-04-04 23:14:35 -04:00
parent 809cf3a0c2
commit 241d0ae65c
2 changed files with 12 additions and 4 deletions

View File

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

View File

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