From aac185e51b271c0778ca97b864a28d7f8b7b0c99 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 8 Sep 2018 14:43:49 -0400 Subject: [PATCH 1/2] Add restart on config change if possible --- src/Tgstation.Server.Host/Core/Application.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index a397f43b17..17404a3033 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -10,6 +10,7 @@ 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; @@ -221,7 +222,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)); @@ -229,6 +231,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 From 6c743e06ee5ea95965990e77b0e89846d0c8822b Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 8 Sep 2018 14:44:00 -0400 Subject: [PATCH 2/2] Remove unused using --- src/Tgstation.Server.Host/Core/Application.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 17404a3033..fa6d8264aa 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -3,7 +3,6 @@ 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;