Fix misuse of OD logging cvars

This commit is contained in:
Jordan Dominion
2023-11-17 21:41:22 -05:00
parent a4b00b0810
commit fab05fdafc
4 changed files with 13 additions and 3 deletions
@@ -53,7 +53,7 @@ namespace Tgstation.Server.Host.Components.Engine
/// <param name="dmbProvider">The <see cref="IDmbProvider"/>.</param>
/// <param name="parameters">The map of parameter <see cref="string"/>s as a <see cref="IReadOnlyDictionary{TKey, TValue}"/>. Should NOT include the <see cref="DreamDaemonLaunchParameters.AdditionalParameters"/> of <paramref name="launchParameters"/>.</param>
/// <param name="launchParameters">The <see cref="DreamDaemonLaunchParameters"/>.</param>
/// <param name="logFilePath">The path to the log file, if any.</param>
/// <param name="logFilePath">The full path to the log file, if any.</param>
/// <returns>The formatted arguments <see cref="string"/>.</returns>
string FormatServerArguments(
IDmbProvider dmbProvider,
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Host.Components.Deployment;
using Tgstation.Server.Host.IO;
namespace Tgstation.Server.Host.Components.Engine
{
@@ -34,19 +35,27 @@ namespace Tgstation.Server.Host.Components.Engine
/// <inheritdoc />
public override Task InstallationTask { get; }
/// <summary>
/// The <see cref="IIOManager"/> for the <see cref="OpenDreamInstallation"/>.
/// </summary>
readonly IIOManager ioManager;
/// <summary>
/// Initializes a new instance of the <see cref="OpenDreamInstallation"/> class.
/// </summary>
/// <param name="ioManager">The value of <see cref="ioManager"/>.</param>
/// <param name="serverExePath">The value of <see cref="ServerExePath"/>.</param>
/// <param name="compilerExePath">The value of <see cref="CompilerExePath"/>.</param>
/// <param name="installationTask">The value of <see cref="InstallationTask"/>.</param>
/// <param name="version">The value of <see cref="Version"/>.</param>
public OpenDreamInstallation(
IIOManager ioManager,
string serverExePath,
string compilerExePath,
Task installationTask,
EngineVersion version)
{
this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
ServerExePath = serverExePath ?? throw new ArgumentNullException(nameof(serverExePath));
CompilerExePath = compilerExePath ?? throw new ArgumentNullException(nameof(compilerExePath));
InstallationTask = installationTask ?? throw new ArgumentNullException(nameof(installationTask));
@@ -70,7 +79,7 @@ namespace Tgstation.Server.Host.Components.Engine
var parametersString = EncodeParameters(parameters, launchParameters);
var loggingEnabled = logFilePath != null;
var arguments = $"--cvar {(loggingEnabled ? $"log.path=\"{logFilePath}\"" : "log.enabled=false")} --cvar net.port={launchParameters.Port.Value} --cvar opendream.topic_port=0 --cvar opendream.world_params=\"{parametersString}\" --cvar opendream.json_path=\"./{dmbProvider.DmbName}\"";
var arguments = $"--cvar {(loggingEnabled ? $"log.path=\"{ioManager.GetDirectoryName(logFilePath)}\" --cvar log.format=\"{ioManager.GetFileName(logFilePath)}\"" : "log.enabled=false")} --cvar log.runtimelog=false --cvar net.port={launchParameters.Port.Value} --cvar opendream.topic_port=0 --cvar opendream.world_params=\"{parametersString}\" --cvar opendream.json_path=\"./{dmbProvider.DmbName}\"";
return arguments;
}
@@ -98,6 +98,7 @@ namespace Tgstation.Server.Host.Components.Engine
CheckVersionValidity(version);
GetExecutablePaths(path, out var serverExePath, out var compilerExePath);
return new OpenDreamInstallation(
IOManager,
serverExePath,
compilerExePath,
installationTask,
@@ -474,7 +474,7 @@ namespace Tgstation.Server.Host.Components.Session
/// <param name="engineLock">The <see cref="IEngineExecutableLock"/>.</param>
/// <param name="launchParameters">The <see cref="DreamDaemonLaunchParameters"/>.</param>
/// <param name="accessIdentifier">The secure string to use for the session.</param>
/// <param name="logFilePath">The path to log DreamDaemon output to.</param>
/// <param name="logFilePath">The full path to log DreamDaemon output to.</param>
/// <param name="apiValidate">If we are only validating the DMAPI then exiting.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
/// <returns>A <see cref="ValueTask{TResult}"/> resulting in the DreamDaemon <see cref="IProcess"/>.</returns>