From f8b0d62c601fb33347c03404850221d94e8fd247 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Thu, 23 Nov 2023 18:03:40 -0500 Subject: [PATCH] Nullify `ServerFactory` --- src/Tgstation.Server.Host/IServerFactory.cs | 4 +--- src/Tgstation.Server.Host/Program.cs | 2 +- src/Tgstation.Server.Host/ServerFactory.cs | 7 +++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Tgstation.Server.Host/IServerFactory.cs b/src/Tgstation.Server.Host/IServerFactory.cs index 937fee7184..b205d6b62e 100644 --- a/src/Tgstation.Server.Host/IServerFactory.cs +++ b/src/Tgstation.Server.Host/IServerFactory.cs @@ -3,8 +3,6 @@ using System.Threading.Tasks; using Tgstation.Server.Host.IO; -#nullable disable - namespace Tgstation.Server.Host { /// @@ -24,6 +22,6 @@ namespace Tgstation.Server.Host /// The directory in which to install server updates. /// The for the operation. /// A resulting in a new if it should be run, otherwise. - ValueTask CreateServer(string[] args, string updatePath, CancellationToken cancellationToken); + ValueTask CreateServer(string[] args, string? updatePath, CancellationToken cancellationToken); } } diff --git a/src/Tgstation.Server.Host/Program.cs b/src/Tgstation.Server.Host/Program.cs index 8f0c5a3867..b23633b7df 100644 --- a/src/Tgstation.Server.Host/Program.cs +++ b/src/Tgstation.Server.Host/Program.cs @@ -83,7 +83,7 @@ namespace Tgstation.Server.Host { using var shutdownNotifier = new ProgramShutdownTokenSource(); var cancellationToken = shutdownNotifier.Token; - IServer server; + IServer? server; try { server = await ServerFactory.CreateServer( diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index 4b25e07fea..f92298da10 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -17,8 +17,6 @@ using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Setup; using Tgstation.Server.Host.System; -#nullable disable - namespace Tgstation.Server.Host { /// @@ -53,7 +51,7 @@ namespace Tgstation.Server.Host /// // TODO: Decomplexify #pragma warning disable CA1506 - public async ValueTask CreateServer(string[] args, string updatePath, CancellationToken cancellationToken) + public async ValueTask CreateServer(string[] args, string? updatePath, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(args); @@ -98,7 +96,8 @@ namespace Tgstation.Server.Host #if !NET8_0 #error Validate this monstrosity works on current .NET #endif - IConfigurationSource cmdLineConfig, baseYmlConfig, environmentYmlConfig; + IConfigurationSource? cmdLineConfig; + IConfigurationSource baseYmlConfig, environmentYmlConfig; if (args.Length == 0) { cmdLineConfig = null;