Nullify InternalConfiguration

This commit is contained in:
Jordan Dominion
2023-11-23 19:08:31 -05:00
parent e8a1009a46
commit a3b81f8377
2 changed files with 11 additions and 11 deletions
@@ -1,6 +1,4 @@
#nullable disable
namespace Tgstation.Server.Host.Configuration
namespace Tgstation.Server.Host.Configuration
{
/// <summary>
/// Unstable configuration options used internally by TGS.
@@ -15,12 +13,12 @@ namespace Tgstation.Server.Host.Configuration
/// <summary>
/// The name of the pipe opened by the host watchdog for sending commands, if any.
/// </summary>
public string CommandPipe { get; set; }
public string? CommandPipe { get; set; }
/// <summary>
/// The name of the pipe opened by the host watchdog for receiving commands, if any.
/// </summary>
public string ReadyPipe { get; set; }
public string? ReadyPipe { get; set; }
/// <summary>
/// If the server is running under SystemD.
@@ -30,7 +28,7 @@ namespace Tgstation.Server.Host.Configuration
/// <summary>
/// The base path for the app settings configuration files.
/// </summary>
public string AppSettingsBasePath { get; set; }
public string? AppSettingsBasePath { get; set; }
/// <summary>
/// Coerce the <see cref="Setup.SetupWizard"/> to select <see cref="DatabaseType.MariaDB"/>.
@@ -40,6 +38,6 @@ namespace Tgstation.Server.Host.Configuration
/// <summary>
/// Generate default configuration using the given <see cref="DatabaseType.MariaDB"/> default password.
/// </summary>
public string MariaDBDefaultRootPassword { get; set; }
public string? MariaDBDefaultRootPassword { get; set; }
}
}
@@ -65,22 +65,24 @@ namespace Tgstation.Server.Host.Core
logger.LogTrace("Starting...");
// grab both pipes asap so we can close them on error
var supportsPipeCommands = !String.IsNullOrWhiteSpace(internalConfiguration.CommandPipe);
var commandPipe = internalConfiguration.CommandPipe;
var supportsPipeCommands = !String.IsNullOrWhiteSpace(commandPipe);
await using var commandPipeClient = supportsPipeCommands
? new AnonymousPipeClientStream(
PipeDirection.In,
internalConfiguration.CommandPipe)
commandPipe!)
: null;
if (!supportsPipeCommands)
logger.LogDebug("No command pipe name specified in configuration");
var supportsReadyNotification = !String.IsNullOrWhiteSpace(internalConfiguration.ReadyPipe);
var readyPipe = internalConfiguration.ReadyPipe;
var supportsReadyNotification = !String.IsNullOrWhiteSpace(readyPipe);
if (supportsReadyNotification)
{
await using var readyPipeClient = new AnonymousPipeClientStream(
PipeDirection.Out,
internalConfiguration.ReadyPipe);
readyPipe!);
logger.LogTrace("Waiting to send ready notification...");
await instanceManager.Ready.WaitAsync(cancellationToken);