diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index dd9de80415..ea72e0aba3 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -3,13 +3,13 @@ using Cyberboss.AspNetCore.AsyncInitializer; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Primitives; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using System; @@ -223,7 +223,8 @@ namespace Tgstation.Server.Host.Core /// /// The to configure /// The for the - public void Configure(IApplicationBuilder applicationBuilder, ILogger logger) + /// The for the application + public void Configure(IApplicationBuilder applicationBuilder, ILogger logger, IServerControl serverControl) { if (applicationBuilder == null) throw new ArgumentNullException(nameof(applicationBuilder)); @@ -231,6 +232,9 @@ namespace Tgstation.Server.Host.Core throw new ArgumentNullException(nameof(logger)); logger.LogInformation(VersionString); + + //attempt to restart the server if the configuration changes + ChangeToken.OnChange(configuration.GetReloadToken, () => serverControl.Restart()); applicationBuilder.UseDeveloperExceptionPage(); //it is not worth it to limit this, you should only ever get it if you're an authorized user