mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 21:16:52 +01:00
Fix configuration "reloading" during setup wizard
It runs again after setup so it's completely unnecessary.
This commit is contained in:
@@ -24,6 +24,11 @@ namespace Tgstation.Server.Host
|
||||
/// </summary>
|
||||
sealed class ServerFactory : IServerFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the appsettings file.
|
||||
/// </summary>
|
||||
public const string AppSettings = "appsettings";
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IAssemblyInformationProvider"/> for the <see cref="ServerFactory"/>.
|
||||
/// </summary>
|
||||
@@ -60,7 +65,6 @@ namespace Tgstation.Server.Host
|
||||
args[oldArgs.Length] = "--hostBuilder:reloadConfigOnChange=false";
|
||||
}
|
||||
|
||||
const string AppSettings = "appsettings";
|
||||
const string AppSettingsRelocationKey = $"--{AppSettings}-base-path=";
|
||||
|
||||
var appsettingsRelativeBasePathArgument = args.FirstOrDefault(arg => arg.StartsWith(AppSettingsRelocationKey, StringComparison.Ordinal));
|
||||
|
||||
@@ -87,11 +87,6 @@ namespace Tgstation.Server.Host.Setup
|
||||
/// </summary>
|
||||
readonly InternalConfiguration internalConfiguration;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="TaskCompletionSource"/> that will complete when the <see cref="IConfiguration"/> is reloaded.
|
||||
/// </summary>
|
||||
TaskCompletionSource reloadTcs;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SetupWizard"/> class.
|
||||
/// </summary>
|
||||
@@ -131,12 +126,6 @@ namespace Tgstation.Server.Host.Setup
|
||||
|
||||
generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
|
||||
internalConfiguration = internalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(internalConfigurationOptions));
|
||||
|
||||
configuration
|
||||
.GetReloadToken()
|
||||
.RegisterChangeCallback(
|
||||
state => reloadTcs?.TrySetResult(),
|
||||
null);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -1014,19 +1003,12 @@ namespace Tgstation.Server.Host.Setup
|
||||
|
||||
var configBytes = Encoding.UTF8.GetBytes(serializedYaml);
|
||||
|
||||
reloadTcs = new TaskCompletionSource();
|
||||
|
||||
try
|
||||
{
|
||||
await ioManager.WriteAllBytes(
|
||||
userConfigFileName,
|
||||
configBytes,
|
||||
cancellationToken);
|
||||
|
||||
// Ensure the reload
|
||||
if (generalConfiguration.SetupWizardMode != SetupWizardMode.Only)
|
||||
using (cancellationToken.Register(() => reloadTcs.TrySetCanceled()))
|
||||
await reloadTcs.Task;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
@@ -1108,7 +1090,7 @@ namespace Tgstation.Server.Host.Setup
|
||||
|
||||
var userConfigFileName = ioManager.ConcatPath(
|
||||
internalConfiguration.AppSettingsBasePath,
|
||||
String.Format(CultureInfo.InvariantCulture, "appsettings.{0}.yml", hostingEnvironment.EnvironmentName));
|
||||
$"{ServerFactory.AppSettings}.{hostingEnvironment.EnvironmentName}.yml");
|
||||
|
||||
async Task HandleSetupCancel()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user