tgstation-server 6.8.0
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
12using YamlDotNet.Serialization;
13
15{
20 {
24 public const string Section = "General";
25
29 public const ushort DefaultApiPort = 5000;
30
35
39 const uint DefaultInstanceLimit = 10;
40
44 const uint DefaultUserLimit = 100;
45
49 const uint DefaultUserGroupLimit = 25;
50
54 const uint DefaultByondTopicTimeout = 5000;
55
60
65
69 const string DefaultOpenDreamGitUrl = "https://github.com/OpenDreamProject/OpenDream";
70
74 const string DefaultOpenDreamGitTagPrefix = "v";
75
79 public static readonly Version CurrentConfigVersion = Version.Parse(MasterVersionsAttribute.Instance.RawConfigurationVersion);
80
84 public Version? ConfigVersion { get; set; }
85
89 public ushort ApiPort { get; set; }
90
94 public string? GitHubAccessToken { get; set; }
95
99 [JsonConverter(typeof(StringEnumConverter))]
100 public SetupWizardMode SetupWizardMode { get; set; }
101
105 public uint ByondTopicTimeout { get; set; } = DefaultByondTopicTimeout;
106
111
116
120 public bool UseBasicWatchdog { get; set; }
121
125 public bool HostApiDocumentation { get; set; }
126
130 public bool SkipAddingByondFirewallException { get; set; }
131
135 public uint? DeploymentDirectoryCopyTasksPerCore { get; set; }
136
140 [YamlMember(SerializeAs = typeof(string))]
141 public Uri OpenDreamGitUrl { get; set; } = new Uri(DefaultOpenDreamGitUrl);
142
147
151 public bool OpenDreamSuppressInstallOutput { get; set; }
152
157 {
162 }
163
168 public void CheckCompatibility(ILogger logger)
169 {
170 ArgumentNullException.ThrowIfNull(logger);
171
172 if (ConfigVersion == null)
173 logger.LogCritical(
174 "No `ConfigVersion` specified, your configuration may be out of date! The current version is \"{currentVersion}\"",
177 if (ConfigVersion.Major != CurrentConfigVersion.Major)
178 logger.LogCritical(
179 "Your `ConfigVersion` is majorly out-of-date and may potentially cause issues running the server. Please follow migration instructions from the TGS release notes. The current config version is v{currentConfigVersion}.",
181 else
182 logger.LogWarning("Your `ConfigVersion` is out-of-date. Please follow migration instructions from the TGS release notes.");
183
185 throw new InvalidOperationException(
186 $"{nameof(DeploymentDirectoryCopyTasksPerCore)} must be at least 1!");
187 else if (this.GetCopyDirectoryTaskThrottle() < 1)
188 throw new InvalidOperationException(
189 $"{nameof(DeploymentDirectoryCopyTasksPerCore)} is too large for the CPU core count of {Environment.ProcessorCount} and overflows a 32-bit signed integer. Please lower the value!");
190
191 if (ByondTopicTimeout <= 1000)
192 logger.LogWarning("The timeout for sending BYOND topics is very low ({ms}ms). Topic calls may fail to complete at all!", ByondTopicTimeout);
193 }
194 }
195}
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...
bool OpenDreamSuppressInstallOutput
If the dotnet output of creating an OpenDream installation should be suppressed. Known to cause issue...
const string DefaultOpenDreamGitTagPrefix
The default value for OpenDreamGitTagPrefix.
GeneralConfiguration()
Initializes a new instance of the GeneralConfiguration class.
void CheckCompatibility(ILogger logger)
Validates the current ConfigVersion's compatibility and provides migration instructions.
Uri OpenDreamGitUrl
Location of a publically accessible OpenDream repository.
static readonly Version CurrentConfigVersion
The current ConfigVersion.
bool HostApiDocumentation
If the swagger documentation and UI should be made avaiable.
bool UseBasicWatchdog
If the Components.Watchdog.BasicWatchdog should be preferred.
const string DefaultOpenDreamGitUrl
The default value for OpenDreamGitUrl.
uint ShutdownTimeoutMinutes
The timeout minutes for gracefully stopping the server.
string OpenDreamGitTagPrefix
The prefix to the OpenDream semver as tags appear in the git repository.
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 ...
const uint DefaultRestartTimeoutMinutes
The default value for RestartTimeoutMinutes.
const uint DefaultUserLimit
The default value for ServerInformationBase.UserLimit.
Version? ConfigVersion
The Version the file says it is.
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.