Add prompt for SQLServer connection encryption

This commit is contained in:
Jordan Dominion
2023-08-24 19:47:00 -04:00
parent 9e5487494e
commit fd1e73dfd4
2 changed files with 7 additions and 3 deletions
@@ -501,16 +501,16 @@ namespace Tgstation.Server.Host.Setup
}
while (true);
bool useWinAuth;
var useWinAuth = false;
var encrypt = false;
if (databaseConfiguration.DatabaseType == DatabaseType.SqlServer && platformIdentifier.IsWindows)
{
var defaultResponse = serverAddressEntry?.AddressList.Any(IPAddress.IsLoopback) ?? false
? (bool?)true
: null;
useWinAuth = await PromptYesNo("Use Windows Authentication?", defaultResponse, cancellationToken);
encrypt = await PromptYesNo("Use encrypted connection?", false, cancellationToken);
}
else
useWinAuth = false;
await console.WriteAsync(null, true, cancellationToken);
@@ -566,6 +566,8 @@ namespace Tgstation.Server.Host.Setup
csb.Password = password;
}
csb.Encrypt = encrypt;
CreateTestConnection(csb.ConnectionString);
csb.InitialCatalog = databaseName;
databaseConfiguration.ConnectionString = csb.ConnectionString;
@@ -181,6 +181,8 @@ namespace Tgstation.Server.Host.Setup.Tests
"no",
//test winauth
"yes",
// encrypt
"YES",
//sql server will always fail so reconfigure with maria
nameof(DatabaseType.MariaDB),
"127.0.0.1",