diff --git a/src/Tgstation.Server.Host.Console/Program.cs b/src/Tgstation.Server.Host.Console/Program.cs index f88188d7b4..c1c9c4dbc7 100644 --- a/src/Tgstation.Server.Host.Console/Program.cs +++ b/src/Tgstation.Server.Host.Console/Program.cs @@ -17,7 +17,15 @@ namespace Tgstation.Server.Host.Console /// /// The for the . /// - internal static IWatchdogFactory WatchdogFactory { get; set; } = new WatchdogFactory(); + internal static IWatchdogFactory WatchdogFactory { get; set; } + + /// + /// Initializes static members of the class. + /// + static Program() + { + WatchdogFactory = new WatchdogFactory(); + } /// /// Entrypoint for the application. diff --git a/src/Tgstation.Server.Host/Controllers/BridgeController.cs b/src/Tgstation.Server.Host/Controllers/BridgeController.cs index f1c46d67d6..b2a03654b9 100644 --- a/src/Tgstation.Server.Host/Controllers/BridgeController.cs +++ b/src/Tgstation.Server.Host/Controllers/BridgeController.cs @@ -27,7 +27,7 @@ namespace Tgstation.Server.Host.Controllers /// /// If the content of bridge requests and responses should be logged. /// - internal static bool LogContent { get; set; } = true; + internal static bool LogContent { get; set; } /// /// Static counter for the number of requests processed. @@ -44,6 +44,14 @@ namespace Tgstation.Server.Host.Controllers /// readonly ILogger logger; + /// + /// Initializes static members of the class. + /// + static BridgeController() + { + LogContent = true; + } + /// /// Initializes a new instance of the class. /// diff --git a/src/Tgstation.Server.Host/Swarm/SwarmService.cs b/src/Tgstation.Server.Host/Swarm/SwarmService.cs index 48cf0a43b1..25d9973079 100644 --- a/src/Tgstation.Server.Host/Swarm/SwarmService.cs +++ b/src/Tgstation.Server.Host/Swarm/SwarmService.cs @@ -52,20 +52,7 @@ namespace Tgstation.Server.Host.Swarm /// /// See for the swarm system. /// - internal static JsonSerializerSettings SerializerSettings { get; } = new () - { - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy(), - }, - Converters = new JsonConverter[] - { - new VersionConverter(), - new BoolConverter(), - }, - DefaultValueHandling = DefaultValueHandling.Ignore, - ReferenceLoopHandling = ReferenceLoopHandling.Ignore, - }; + internal static JsonSerializerSettings SerializerSettings { get; } /// public bool ExpectedNumberOfNodesConnected @@ -187,6 +174,27 @@ namespace Tgstation.Server.Host.Swarm /// bool serversDirty; + /// + /// Initializes static members of the class. + /// + static SwarmService() + { + SerializerSettings = new () + { + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy(), + }, + Converters = new JsonConverter[] + { + new VersionConverter(), + new BoolConverter(), + }, + DefaultValueHandling = DefaultValueHandling.Ignore, + ReferenceLoopHandling = ReferenceLoopHandling.Ignore, + }; + } + /// /// Initializes a new instance of the class. ///