tgstation-server 5.12.7
The /tg/station 13 server suite
Loading...
Searching...
No Matches
GeneralConfiguration.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.Extensions.Logging;
4using Newtonsoft.Json;
5using Newtonsoft.Json.Converters;
6
11
13{
18 {
22 public const string Section = "General";
23
27 public const ushort DefaultApiPort = 5000;
28
33
37 const uint DefaultInstanceLimit = 10;
38
42 const uint DefaultUserLimit = 100;
43
47 const uint DefaultUserGroupLimit = 25;
48
52 const uint DefaultByondTopicTimeout = 5000;
53
58
63
67 public static readonly Version CurrentConfigVersion = Version.Parse(MasterVersionsAttribute.Instance.RawConfigurationVersion);
68
72 public Version ConfigVersion { get; set; }
73
77 public ushort ApiPort { get; set; }
78
82 public string GitHubAccessToken { get; set; }
83
87 [JsonConverter(typeof(StringEnumConverter))]
88 public SetupWizardMode SetupWizardMode { get; set; }
89
93 public uint ByondTopicTimeout { get; set; } = DefaultByondTopicTimeout;
94
99
104
108 public bool UseBasicWatchdog { get; set; }
109
113 public bool HostApiDocumentation { get; set; }
114
118 public bool SkipAddingByondFirewallException { get; set; }
119
123 public uint? DeploymentDirectoryCopyTasksPerCore { get; set; }
124
129 {
134 }
135
140 public void CheckCompatibility(ILogger logger)
141 {
142 ArgumentNullException.ThrowIfNull(logger);
143
144 if (ConfigVersion == null)
145 logger.LogCritical(
146 "No `ConfigVersion` specified, your configuration may be out of date! The current version is \"{currentVersion}\"",
149 if (ConfigVersion.Major != CurrentConfigVersion.Major)
150 logger.LogCritical(
151 "Your `ConfigVersion` is majorly out-of-date and may potentially cause issues running the server. Please follow migration instructions from the TGS release notes.",
153 else
154 logger.LogWarning("Your `ConfigVersion` is out-of-date. Please follow migration instructions from the TGS release notes.");
155
157 throw new InvalidOperationException(
158 $"{nameof(DeploymentDirectoryCopyTasksPerCore)} must be at least 1!");
159 else if (this.GetCopyDirectoryTaskThrottle() < 1)
160 throw new InvalidOperationException(
161 $"{nameof(DeploymentDirectoryCopyTasksPerCore)} is too large for the CPU core count of {Environment.ProcessorCount} and overflows a 32-bit signed integer. Please lower the value!");
162 }
163 }
164}
Base class for Response.ServerInformationResponse.
uint UserGroupLimit
The maximum number of user groups allowed.
uint MinimumPasswordLength
Minimum length of database user passwords.
uint InstanceLimit
The maximum number of Instances allowed.
uint? DeploymentDirectoryCopyTasksPerCore
A limit on the amount of tasks used for asynchronous I/O when copying directories during the deployme...
const string Section
The key for the Microsoft.Extensions.Configuration.IConfigurationSection the GeneralConfiguration res...
GeneralConfiguration()
Initializes a new instance of the GeneralConfiguration class.
void CheckCompatibility(ILogger logger)
Validates the current ConfigVersion's compatibility and provides migration instructions.
static readonly Version CurrentConfigVersion
The current ConfigVersion.
bool HostApiDocumentation
If the swagger UI should be made avaiable.
bool UseBasicWatchdog
If the Components.Watchdog.BasicWatchdog should be preferred.
uint ShutdownTimeoutMinutes
The timeout minutes for gracefully stopping the server.
const uint DefaultMinimumPasswordLength
The default value for ServerInformationBase.MinimumPasswordLength.
const ushort DefaultApiPort
The default value of ApiPort.
uint RestartTimeoutMinutes
The timeout minutes for restarting the server.
uint ByondTopicTimeout
The timeout in milliseconds for sending and receiving topics to/from DreamDaemon. Note that a single ...
Version ConfigVersion
The Version the file says it is.
const uint DefaultRestartTimeoutMinutes
The default value for RestartTimeoutMinutes.
const uint DefaultUserLimit
The default value for ServerInformationBase.UserLimit.
string GitHubAccessToken
A GitHub personal access token to use for bypassing rate limits on requests. Requires no scopes.
const uint DefaultByondTopicTimeout
The default value for ByondTopicTimeout.
const uint DefaultInstanceLimit
The default value for ServerInformationBase.InstanceLimit.
const uint DefaultUserGroupLimit
The default value for ServerInformationBase.UserGroupLimit.
const uint DefaultShutdownTimeoutMinutes
The default value for ShutdownTimeoutMinutes.
bool SkipAddingByondFirewallException
If the netsh.exe execution to exempt DreamDaemon from Windows firewall should be skipped.
Attribute for bringing in the master versions list from MSBuild that aren't embedded into assemblies ...
string RawConfigurationVersion
The Version string of the Configuration version built.
static MasterVersionsAttribute Instance
Return the Assembly's instance of the MasterVersionsAttribute.
SetupWizardMode
Determines if the SetupWizard will run.