mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-26 06:27:19 +01:00
Set TGS_INSTANCE_ROOT env var in event scripts
This commit is contained in:
@@ -292,6 +292,7 @@ namespace Tgstation.Server.Host.Components
|
||||
platformIdentifier,
|
||||
fileTransferService,
|
||||
loggerFactory.CreateLogger<StaticFiles.Configuration>(),
|
||||
metadata,
|
||||
generalConfiguration,
|
||||
sessionConfiguration);
|
||||
var eventConsumer = new EventConsumer(configuration);
|
||||
|
||||
@@ -124,6 +124,11 @@ namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
/// </summary>
|
||||
readonly ILogger<Configuration> logger;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Api.Models.Instance"/> the <see cref="Configuration"/> belongs to.
|
||||
/// </summary>
|
||||
readonly Models.Instance metadata;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="GeneralConfiguration"/> for <see cref="Configuration"/>.
|
||||
/// </summary>
|
||||
@@ -159,6 +164,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
/// <param name="postWriteHandler">The value of <see cref="postWriteHandler"/>.</param>
|
||||
/// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
|
||||
/// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
|
||||
/// <param name="metadata">The value of <see cref="metadata"/>.</param>
|
||||
/// <param name="logger">The value of <see cref="logger"/>.</param>
|
||||
/// <param name="generalConfiguration">The value of <see cref="generalConfiguration"/>.</param>
|
||||
/// <param name="sessionConfiguration">The value of <see cref="sessionConfiguration"/>.</param>
|
||||
@@ -171,6 +177,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
IPlatformIdentifier platformIdentifier,
|
||||
IFileTransferTicketProvider fileTransferService,
|
||||
ILogger<Configuration> logger,
|
||||
Models.Instance metadata,
|
||||
GeneralConfiguration generalConfiguration,
|
||||
SessionConfiguration sessionConfiguration)
|
||||
{
|
||||
@@ -182,6 +189,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
|
||||
this.fileTransferService = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
|
||||
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
this.metadata = metadata ?? throw new ArgumentNullException(nameof(metadata));
|
||||
this.generalConfiguration = generalConfiguration ?? throw new ArgumentNullException(nameof(generalConfiguration));
|
||||
this.sessionConfiguration = sessionConfiguration ?? throw new ArgumentNullException(nameof(sessionConfiguration));
|
||||
|
||||
@@ -844,6 +852,10 @@ namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
return $"\"{arg}\"";
|
||||
})),
|
||||
cancellationToken,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{ "TGS_INSTANCE_ROOT", metadata.Path! },
|
||||
},
|
||||
readStandardHandles: true,
|
||||
noShellExecute: true))
|
||||
using (cancellationToken.Register(() => script.Terminate()))
|
||||
|
||||
@@ -4,6 +4,13 @@ set -e
|
||||
|
||||
echo "Running test_event script - $1 - $2"
|
||||
|
||||
if [[ -z "${TGS_INSTANCE_ROOT}" ]]; then
|
||||
echo "TEST ERROR: TGS_INSTANCE_ROOT env var not defined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "TGS_INSTANCE_ROOT: ${TGS_INSTANCE_ROOT}"
|
||||
|
||||
sleep 5
|
||||
|
||||
cd $1
|
||||
|
||||
@@ -53,6 +53,10 @@ namespace Tgstation.Server.Host.Components.StaticFiles.Tests
|
||||
Mock.Of<IPlatformIdentifier>(),
|
||||
Mock.Of<IFileTransferTicketProvider>(),
|
||||
loggerFactory.CreateLogger<Configuration>(),
|
||||
new Models.Instance
|
||||
{
|
||||
Path = "Some path",
|
||||
},
|
||||
new GeneralConfiguration(),
|
||||
new SessionConfiguration());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user