mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-24 21:46:52 +01:00
Nullify ServerFactory
This commit is contained in:
@@ -3,8 +3,6 @@ using System.Threading.Tasks;
|
||||
|
||||
using Tgstation.Server.Host.IO;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tgstation.Server.Host
|
||||
{
|
||||
/// <summary>
|
||||
@@ -24,6 +22,6 @@ namespace Tgstation.Server.Host
|
||||
/// <param name="updatePath">The directory in which to install server updates.</param>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
|
||||
/// <returns>A <see cref="ValueTask{TResult}"/> resulting in a new <see cref="IServer"/> if it should be run, <see langword="null"/> otherwise.</returns>
|
||||
ValueTask<IServer> CreateServer(string[] args, string updatePath, CancellationToken cancellationToken);
|
||||
ValueTask<IServer?> CreateServer(string[] args, string? updatePath, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
@@ -53,7 +51,7 @@ namespace Tgstation.Server.Host
|
||||
/// <inheritdoc />
|
||||
// TODO: Decomplexify
|
||||
#pragma warning disable CA1506
|
||||
public async ValueTask<IServer> CreateServer(string[] args, string updatePath, CancellationToken cancellationToken)
|
||||
public async ValueTask<IServer?> 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;
|
||||
|
||||
Reference in New Issue
Block a user