mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
Make configs actually work with dependency injection
This commit is contained in:
1 parent
a90bbebab9
commit
3321e3049f
4 files changed
+21
-58
No files matched your search
@@ -1,5 +1,4 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Impostor.Server.Utils;
|
||||
using Impostor.Server.Utils;
|
||||
|
||||
namespace Impostor.Server.Config
|
||||
{
|
||||
@@ -9,19 +8,11 @@ namespace Impostor.Server.Config
|
||||
|
||||
private string? _resolvedListenIp;
|
||||
|
||||
[JsonConstructor]
|
||||
public AnnouncementsServerConfig(bool enabled = true, string listenIp = "0.0.0.0", ushort listenPort = 22024)
|
||||
{
|
||||
Enabled = enabled;
|
||||
ListenIp = listenIp;
|
||||
ListenPort = listenPort;
|
||||
}
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
public bool Enabled { get; }
|
||||
public string ListenIp { get; set; } = "0.0.0.0";
|
||||
|
||||
public string ListenIp { get; }
|
||||
|
||||
public ushort ListenPort { get; }
|
||||
public ushort ListenPort { get; set; } = 22024;
|
||||
|
||||
public string ResolveListenIp()
|
||||
{
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Impostor.Server.Config
|
||||
namespace Impostor.Server.Config
|
||||
{
|
||||
public class DebugConfig
|
||||
{
|
||||
public const string Section = "Debug";
|
||||
|
||||
[JsonConstructor]
|
||||
public DebugConfig(bool gameRecorderEnabled = false, string? gameRecorderPath = null)
|
||||
{
|
||||
GameRecorderEnabled = gameRecorderEnabled;
|
||||
GameRecorderPath = gameRecorderPath;
|
||||
}
|
||||
public bool GameRecorderEnabled { get; set; }
|
||||
|
||||
public bool GameRecorderEnabled { get; }
|
||||
|
||||
public string? GameRecorderPath { get; }
|
||||
public string GameRecorderPath { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Impostor.Server.Config
|
||||
{
|
||||
@@ -7,35 +7,21 @@ namespace Impostor.Server.Config
|
||||
{
|
||||
public const string Section = "ServerRedirector";
|
||||
|
||||
[JsonConstructor]
|
||||
public ServerRedirectorConfig(bool enabled = false, bool master = false, NodeLocator? locator = null, List<ServerRedirectorNode>? nodes = null)
|
||||
{
|
||||
Enabled = enabled;
|
||||
Master = master;
|
||||
Locator = locator;
|
||||
Nodes = nodes;
|
||||
}
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public bool Enabled { get; }
|
||||
public bool Master { get; set; }
|
||||
|
||||
public bool Master { get; }
|
||||
public NodeLocator? Locator { get; set; }
|
||||
|
||||
public NodeLocator? Locator { get; }
|
||||
|
||||
public List<ServerRedirectorNode>? Nodes { get; }
|
||||
public List<ServerRedirectorNode>? Nodes { get; set; }
|
||||
|
||||
public class NodeLocator
|
||||
{
|
||||
[JsonConstructor]
|
||||
public NodeLocator(string redis, string udpMasterEndpoint)
|
||||
{
|
||||
Redis = redis;
|
||||
UdpMasterEndpoint = udpMasterEndpoint;
|
||||
}
|
||||
[AllowNull]
|
||||
public string Redis { get; set; }
|
||||
|
||||
public string Redis { get; }
|
||||
|
||||
public string UdpMasterEndpoint { get; }
|
||||
[AllowNull]
|
||||
public string UdpMasterEndpoint { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Impostor.Server.Config
|
||||
{
|
||||
public class ServerRedirectorNode
|
||||
{
|
||||
[JsonConstructor]
|
||||
public ServerRedirectorNode(string ip, ushort port)
|
||||
{
|
||||
Ip = ip;
|
||||
Port = port;
|
||||
}
|
||||
[AllowNull]
|
||||
public string Ip { get; set; }
|
||||
|
||||
public string Ip { get; }
|
||||
|
||||
public ushort Port { get; }
|
||||
[AllowNull]
|
||||
public ushort Port { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user