diff --git a/src/Tgstation.Server.Host/Core/CommandPipeManager.cs b/src/Tgstation.Server.Host/Core/CommandPipeManager.cs index 6a5c6325c6..f3534c9bea 100644 --- a/src/Tgstation.Server.Host/Core/CommandPipeManager.cs +++ b/src/Tgstation.Server.Host/Core/CommandPipeManager.cs @@ -30,22 +30,22 @@ namespace Tgstation.Server.Host.Core /// readonly IInstanceManager instanceManager; + /// + /// The of for the . + /// + readonly IOptions internalConfigurationOptions; + /// /// The for the . /// readonly ILogger logger; - /// - /// The for the . - /// - readonly InternalConfiguration internalConfiguration; - /// /// Initializes a new instance of the class. /// /// The value of . /// The value of . - /// The containing the value of . + /// The containing the value of . /// The value of . public CommandPipeManager( IServerControl serverControl, @@ -55,7 +55,7 @@ namespace Tgstation.Server.Host.Core { this.serverControl = serverControl ?? throw new ArgumentNullException(nameof(serverControl)); this.instanceManager = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager)); - internalConfiguration = internalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(internalConfigurationOptions)); + this.internalConfigurationOptions = internalConfigurationOptions ?? throw new ArgumentNullException(nameof(internalConfigurationOptions)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); } @@ -65,7 +65,7 @@ namespace Tgstation.Server.Host.Core logger.LogTrace("Starting..."); // grab both pipes asap so we can close them on error - var commandPipe = internalConfiguration.CommandPipe; + var commandPipe = internalConfigurationOptions.Value.CommandPipe; var supportsPipeCommands = !String.IsNullOrWhiteSpace(commandPipe); await using var commandPipeClient = supportsPipeCommands ? new AnonymousPipeClientStream( @@ -76,7 +76,7 @@ namespace Tgstation.Server.Host.Core if (!supportsPipeCommands) logger.LogDebug("No command pipe name specified in configuration"); - var readyPipe = internalConfiguration.ReadyPipe; + var readyPipe = internalConfigurationOptions.Value.ReadyPipe; var supportsReadyNotification = !String.IsNullOrWhiteSpace(readyPipe); if (supportsReadyNotification) { diff --git a/src/Tgstation.Server.Host/Core/ServerPortProivder.cs b/src/Tgstation.Server.Host/Core/ServerPortProivder.cs index a3f39a4ab8..67f137ac51 100644 --- a/src/Tgstation.Server.Host/Core/ServerPortProivder.cs +++ b/src/Tgstation.Server.Host/Core/ServerPortProivder.cs @@ -13,28 +13,28 @@ namespace Tgstation.Server.Host.Core sealed class ServerPortProivder : IServerPortProvider { /// - public ushort HttpApiPort => generalConfiguration.ApiPort; + public ushort HttpApiPort => generalConfigurationOptions.Value.ApiPort; /// - /// The for the . + /// The of for the . /// - readonly GeneralConfiguration generalConfiguration; + readonly IOptions generalConfigurationOptions; /// /// Initializes a new instance of the class. /// - /// The containing the value of . /// The to use. + /// The containing the value of . /// The to use. public ServerPortProivder( - IOptions generalConfigurationOptions, IConfiguration configuration, + IOptions generalConfigurationOptions, ILogger logger) { - generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions)); ArgumentNullException.ThrowIfNull(configuration); + this.generalConfigurationOptions = generalConfigurationOptions ?? throw new ArgumentNullException(nameof(generalConfigurationOptions)); - var usingDefaultPort = generalConfiguration.ApiPort == default; + var usingDefaultPort = generalConfigurationOptions.Value.ApiPort == default; if (!usingDefaultPort) return; @@ -55,7 +55,7 @@ namespace Tgstation.Server.Host.Core if (!UInt16.TryParse(portString, out var result)) throw new InvalidOperationException($"Failed to parse HTTP EndPoint port: {httpEndpoint}"); - generalConfiguration.ApiPort = result; + this.generalConfigurationOptions.Value.ApiPort = result; } } }