mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-31 00:50:45 +01:00
Fix default channel being overridden
Fix appsettings.json being saved as YAML
This commit is contained in:
@@ -842,12 +842,25 @@ namespace Tgstation.Server.Host.Setup
|
||||
{ SwarmConfiguration.Section, swarmConfiguration },
|
||||
};
|
||||
|
||||
var builder = new SerializerBuilder()
|
||||
.WithTypeConverter(new VersionConverter());
|
||||
|
||||
if (userConfigFileName.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
|
||||
builder.JsonCompatible();
|
||||
|
||||
var serializer = new SerializerBuilder()
|
||||
.WithTypeConverter(new VersionConverter())
|
||||
.Build();
|
||||
|
||||
var serializedYaml = serializer.Serialize(map);
|
||||
|
||||
// big hack, but, prevent the default control panel channel from being overridden
|
||||
serializedYaml = serializedYaml.Replace(
|
||||
$"\n {nameof(ControlPanelConfiguration.Channel)}: ",
|
||||
String.Empty,
|
||||
StringComparison.Ordinal)
|
||||
.Replace("\r", String.Empty, StringComparison.Ordinal);
|
||||
|
||||
var configBytes = Encoding.UTF8.GetBytes(serializedYaml);
|
||||
|
||||
reloadTcs = new TaskCompletionSource<object>();
|
||||
|
||||
Reference in New Issue
Block a user