mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-25 22:17:51 +01:00
@@ -17,7 +17,6 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -421,14 +420,6 @@ namespace Tgstation.Server.Host.Core
|
||||
logger.LogDebug("Content Root: {contentRoot}", hostingEnvironment.ContentRootPath);
|
||||
logger.LogTrace("Web Root: {webRoot}", hostingEnvironment.WebRootPath);
|
||||
|
||||
// attempt to restart the server if the configuration changes
|
||||
if (serverControl.WatchdogPresent)
|
||||
ChangeToken.OnChange(Configuration.GetReloadToken, () =>
|
||||
{
|
||||
logger.LogInformation("Configuration change detected");
|
||||
serverControl.Restart();
|
||||
});
|
||||
|
||||
// setup the HTTP request pipeline
|
||||
// Add additional logging context to the request
|
||||
applicationBuilder.UseAdditionalRequestLoggingContext(swarmConfiguration);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -48,14 +50,24 @@ namespace Tgstation.Server.Host
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(args);
|
||||
|
||||
// need to shove this arg in to disable config reloading unless a user specifically overrides it
|
||||
if (!args.Any(arg => arg.Contains("hostBuilder:reloadConfigOnChange", StringComparison.OrdinalIgnoreCase))
|
||||
&& String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("hostBuilder__reloadConfigOnChange")))
|
||||
{
|
||||
var oldArgs = args;
|
||||
args = new string[oldArgs.Length + 1];
|
||||
Array.Copy(oldArgs, args, oldArgs.Length);
|
||||
args[oldArgs.Length] = "--hostBuilder:reloadConfigOnChange=false";
|
||||
}
|
||||
|
||||
var basePath = IOManager.ResolvePath();
|
||||
IHostBuilder CreateDefaultBuilder() => Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
|
||||
.ConfigureAppConfiguration((context, builder) =>
|
||||
{
|
||||
builder.SetBasePath(basePath);
|
||||
|
||||
builder.AddYamlFile("appsettings.yml", optional: true, reloadOnChange: true)
|
||||
.AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true);
|
||||
builder.AddYamlFile("appsettings.yml", optional: true, reloadOnChange: false)
|
||||
.AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: false);
|
||||
|
||||
// reorganize the builder so our yaml configs don't override the env/cmdline configs
|
||||
// values obtained via debugger
|
||||
|
||||
Reference in New Issue
Block a user