expose custom config to plugins
add support for some basic game parameters to be set via custom config
This commit is contained in:
@@ -85,9 +85,9 @@ namespace Torch.Server
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
public void Run(IConfiguration configuration)
|
||||
{
|
||||
_server = new TorchServer(Config, ApplicationContext.Current.InstanceDirectory.FullName, ApplicationContext.Current.InstanceName);
|
||||
_server = new TorchServer(Config, ApplicationContext.Current.InstanceDirectory.FullName, ApplicationContext.Current.InstanceName, configuration);
|
||||
|
||||
if (ApplicationContext.Current.IsService || Config.NoGui)
|
||||
{
|
||||
|
@@ -39,7 +39,7 @@ namespace Torch.Server
|
||||
context.GameBinariesDirectory.FullName);
|
||||
#endif
|
||||
|
||||
initializer.Run();
|
||||
initializer.Run(configuration);
|
||||
}
|
||||
|
||||
private static void SetupLogging(IApplicationContext context, IConfiguration configuration)
|
||||
|
@@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.Diagnostics.Runtime;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using PropertyChanged;
|
||||
using Sandbox;
|
||||
@@ -46,8 +47,9 @@ namespace Torch.Server
|
||||
|
||||
//Here to trigger rebuild
|
||||
/// <inheritdoc />
|
||||
public TorchServer(ITorchConfig config, string instancePath, string instanceName) : base(config)
|
||||
public TorchServer(ITorchConfig config, string instancePath, string instanceName, IConfiguration configuration) : base(config)
|
||||
{
|
||||
Configuration = configuration;
|
||||
InstancePath = instancePath;
|
||||
InstanceName = instanceName;
|
||||
DedicatedInstance = new InstanceManager(this);
|
||||
@@ -136,6 +138,8 @@ namespace Torch.Server
|
||||
Log.Info($"Initialized server '{InstanceName}' at '{InstancePath}'");
|
||||
}
|
||||
|
||||
public override IConfiguration Configuration { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Start()
|
||||
{
|
||||
|
@@ -601,6 +601,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )",
|
||||
"Microsoft.Extensions.Configuration.Binder": "[7.0.4, )",
|
||||
"NLog": "[5.1.0, )",
|
||||
"NuGet.Commands": "[6.4.0, )",
|
||||
"NuGet.DependencyResolver.Core": "[6.4.0, )",
|
||||
|
Reference in New Issue
Block a user