diff --git a/src/Tgstation.Server.Host/Setup/SetupWizard.cs b/src/Tgstation.Server.Host/Setup/SetupWizard.cs
index d4611f4465..c164b9d333 100644
--- a/src/Tgstation.Server.Host/Setup/SetupWizard.cs
+++ b/src/Tgstation.Server.Host/Setup/SetupWizard.cs
@@ -31,8 +31,6 @@ using Tgstation.Server.Host.Utils;
using YamlDotNet.Serialization;
-#nullable disable
-
namespace Tgstation.Server.Host.Setup
{
///
@@ -222,9 +220,12 @@ namespace Tgstation.Server.Host.Setup
await console.WriteAsync($"Checking {databaseConfiguration.DatabaseType} version...", true, cancellationToken);
using var command = testConnection.CreateCommand();
command.CommandText = "SELECT VERSION()";
- var fullVersion = (string)await command.ExecuteScalarAsync(cancellationToken);
+ var fullVersion = (string?)await command.ExecuteScalarAsync(cancellationToken);
await console.WriteAsync(String.Format(CultureInfo.InvariantCulture, "Found {0}", fullVersion), true, cancellationToken);
+ if (fullVersion == null)
+ throw new InvalidOperationException($"\"{command.CommandText}\" returned null!");
+
if (databaseConfiguration.DatabaseType == DatabaseType.PostgresSql)
{
var splits = fullVersion.Split(' ');
@@ -293,7 +294,7 @@ namespace Tgstation.Server.Host.Setup
/// The path to the potential SQLite database file.
/// The for the operation.
/// A resulting in the SQLite database path to store in the configuration.
- async ValueTask ValidateNonExistantSqliteDBName(string databaseName, CancellationToken cancellationToken)
+ async ValueTask ValidateNonExistantSqliteDBName(string databaseName, CancellationToken cancellationToken)
{
var dbPathIsRooted = Path.IsPathRooted(databaseName);
var resolvedPath = ioManager.ResolvePath(
@@ -408,12 +409,12 @@ namespace Tgstation.Server.Host.Setup
DatabaseType = await PromptDatabaseType(firstTime, cancellationToken),
};
- string serverAddress = null;
+ string? serverAddress = null;
ushort? serverPort = null;
var definitelyLocalMariaDB = firstTime && internalConfiguration.MariaDBSetup;
var isSqliteDB = databaseConfiguration.DatabaseType == DatabaseType.Sqlite;
- IPHostEntry serverAddressEntry = null;
+ IPHostEntry? serverAddressEntry = null;
if (!isSqliteDB)
do
{
@@ -470,7 +471,7 @@ namespace Tgstation.Server.Host.Setup
await console.WriteAsync(null, true, cancellationToken);
await console.WriteAsync($"Enter the database {(isSqliteDB ? "file path" : "name")} ({(definitelyLocalMariaDB ? "leave blank for \"tgs\")" : "Can be from previous installation. Otherwise, should not exist")}): ", false, cancellationToken);
- string databaseName;
+ string? databaseName;
bool dbExists = false;
do
{
@@ -512,8 +513,8 @@ namespace Tgstation.Server.Host.Setup
await console.WriteAsync(null, true, cancellationToken);
- string username = null;
- string password = null;
+ string? username = null;
+ string? password = null;
if (!isSqliteDB)
if (!useWinAuth)
{
@@ -885,7 +886,7 @@ namespace Tgstation.Server.Host.Setup
///
/// The for the operation.
/// A resulting in the new .
- async ValueTask ConfigureSwarm(CancellationToken cancellationToken)
+ async ValueTask ConfigureSwarm(CancellationToken cancellationToken)
{
var enable = await PromptYesNo("Enable swarm mode?", false, cancellationToken);
if (!enable)
@@ -902,7 +903,7 @@ namespace Tgstation.Server.Host.Setup
async ValueTask ParseAddress(string question)
{
var first = true;
- Uri address;
+ Uri? address;
do
{
if (first)
@@ -933,7 +934,7 @@ namespace Tgstation.Server.Host.Setup
while (String.IsNullOrWhiteSpace(privateKey));
var controller = await PromptYesNo("Is this server the swarm's controller? (y/n): ", null, cancellationToken);
- Uri controllerAddress = null;
+ Uri? controllerAddress = null;
if (!controller)
controllerAddress = await ParseAddress("Enter the swarm controller's HTTP(S) address: ");
@@ -965,15 +966,15 @@ namespace Tgstation.Server.Host.Setup
ushort? hostingPort,
DatabaseConfiguration databaseConfiguration,
GeneralConfiguration newGeneralConfiguration,
- FileLoggingConfiguration fileLoggingConfiguration,
- ElasticsearchConfiguration elasticsearchConfiguration,
+ FileLoggingConfiguration? fileLoggingConfiguration,
+ ElasticsearchConfiguration? elasticsearchConfiguration,
ControlPanelConfiguration controlPanelConfiguration,
- SwarmConfiguration swarmConfiguration,
+ SwarmConfiguration? swarmConfiguration,
CancellationToken cancellationToken)
{
newGeneralConfiguration.ApiPort = hostingPort ?? GeneralConfiguration.DefaultApiPort;
newGeneralConfiguration.ConfigVersion = GeneralConfiguration.CurrentConfigVersion;
- var map = new Dictionary()
+ var map = new Dictionary()
{
{ DatabaseConfiguration.Section, databaseConfiguration },
{ GeneralConfiguration.Section, newGeneralConfiguration },
@@ -1097,7 +1098,7 @@ namespace Tgstation.Server.Host.Setup
}
Task finalTask = Task.CompletedTask;
- string originalConsoleTitle = null;
+ string? originalConsoleTitle = null;
void SetConsoleTitle()
{
if (originalConsoleTitle != null)