mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-24 21:46:52 +01:00
allow on docker
This commit is contained in:
@@ -69,6 +69,7 @@ EXPOSE 5000
|
||||
|
||||
ENV General__ValidInstancePaths__0 /tgs_instances
|
||||
ENV FileLogging__Directory /tgs_logs
|
||||
ENV Internal__UsingDocker true
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -130,6 +130,11 @@ namespace Tgstation.Server.Host.Components
|
||||
/// </summary>
|
||||
readonly SwarmConfiguration swarmConfiguration;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="InternalConfiguration"/> for the <see cref="InstanceManager"/>.
|
||||
/// </summary>
|
||||
readonly InternalConfiguration internalConfiguration;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="TaskCompletionSource"/> for <see cref="Ready"/>.
|
||||
/// </summary>
|
||||
@@ -177,6 +182,7 @@ namespace Tgstation.Server.Host.Components
|
||||
/// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
|
||||
/// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
|
||||
/// <param name="swarmConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="swarmConfiguration"/>.</param>
|
||||
/// <param name="internalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="internalConfiguration"/>.</param>
|
||||
/// <param name="logger">The value of <see cref="logger"/>.</param>
|
||||
public InstanceManager(
|
||||
IInstanceFactory instanceFactory,
|
||||
@@ -193,6 +199,7 @@ namespace Tgstation.Server.Host.Components
|
||||
IPlatformIdentifier platformIdentifier,
|
||||
IOptions<GeneralConfiguration> generalConfigurationOptions,
|
||||
IOptions<SwarmConfiguration> swarmConfigurationOptions,
|
||||
IOptions<InternalConfiguration> internalConfigurationOptions,
|
||||
ILogger<InstanceManager> logger)
|
||||
{
|
||||
this.instanceFactory = instanceFactory ?? throw new ArgumentNullException(nameof(instanceFactory));
|
||||
@@ -209,6 +216,7 @@ namespace Tgstation.Server.Host.Components
|
||||
this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
|
||||
generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
|
||||
swarmConfiguration = swarmConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(swarmConfigurationOptions));
|
||||
internalConfiguration = internalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(internalConfigurationOptions));
|
||||
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
|
||||
originalConsoleTitle = console.Title;
|
||||
@@ -676,7 +684,7 @@ namespace Tgstation.Server.Host.Components
|
||||
if (!systemIdentity.CanCreateSymlinks)
|
||||
throw new InvalidOperationException($"The user running {Constants.CanonicalPackageName} cannot create symlinks! Please try running as an administrative user!");
|
||||
|
||||
if (!platformIdentifier.IsWindows && systemIdentity.IsSuperUser)
|
||||
if (!platformIdentifier.IsWindows && systemIdentity.IsSuperUser && !internalConfiguration.UsingDocker)
|
||||
{
|
||||
logger.LogWarning("TGS is being run as the root account. This is not recommended and may prevent launch in a future version.");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Tgstation.Server.Host.Configuration
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Unstable configuration options used internally by TGS.
|
||||
@@ -25,6 +27,11 @@
|
||||
/// </summary>
|
||||
public bool UsingSystemD { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the server is running inside of a Docker container.
|
||||
/// </summary>
|
||||
public bool UsingDocker => Environment.GetEnvironmentVariable("Internal__UsingDocker")?.Equals("true", StringComparison.OrdinalIgnoreCase) ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// The base path for the app settings configuration files.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user