diff --git a/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs b/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs
index 69d5ec1b30..4b925e9342 100644
--- a/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs
+++ b/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
@@ -24,7 +24,7 @@ namespace Tgstation.Server.Host.Configuration
///
/// The current .
///
- public static readonly Version CurrentConfigVersion = new Version(2, 0, 0);
+ public static readonly Version CurrentConfigVersion = new Version(2, 1, 0);
///
/// The default value for .
@@ -87,6 +87,11 @@ namespace Tgstation.Server.Host.Configuration
///
public bool UseBasicWatchdog { get; set; }
+ ///
+ /// If the swagger UI should be made avaiable.
+ ///
+ public bool HostApiDocumemtation { get; set; }
+
///
/// Initializes a new instance of the .
///
diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs
index a5104530bc..52a837f345 100644
--- a/src/Tgstation.Server.Host/Core/Application.cs
+++ b/src/Tgstation.Server.Host/Core/Application.cs
@@ -394,7 +394,8 @@ namespace Tgstation.Server.Host.Core
// suppress OperationCancelledExceptions, they are just aborted HTTP requests
applicationBuilder.UseCancelledRequestSuppression();
- if (hostingEnvironment.IsDevelopment())
+ if (hostingEnvironment.IsDevelopment()
+ || generalConfiguration.HostApiDocumemtation)
{
applicationBuilder.UseSwagger();
applicationBuilder.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "TGS API V4"));
diff --git a/src/Tgstation.Server.Host/Setup/SetupWizard.cs b/src/Tgstation.Server.Host/Setup/SetupWizard.cs
index fe7fdf4e00..b32bd9206d 100644
--- a/src/Tgstation.Server.Host/Setup/SetupWizard.cs
+++ b/src/Tgstation.Server.Host/Setup/SetupWizard.cs
@@ -1,4 +1,4 @@
-using Microsoft.Data.Sqlite;
+using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@@ -613,6 +613,8 @@ namespace Tgstation.Server.Host.Setup
if (String.IsNullOrWhiteSpace(newGeneralConfiguration.GitHubAccessToken))
newGeneralConfiguration.GitHubAccessToken = null;
+ newGeneralConfiguration.HostApiDocumemtation = await PromptYesNo("Host API Documentation? (y/n): ", cancellationToken).ConfigureAwait(false);
+
return newGeneralConfiguration;
}
diff --git a/src/Tgstation.Server.Host/appsettings.json b/src/Tgstation.Server.Host/appsettings.json
index 49409225a3..8bcf394cc2 100644
--- a/src/Tgstation.Server.Host/appsettings.json
+++ b/src/Tgstation.Server.Host/appsettings.json
@@ -1,4 +1,4 @@
-{
+{
"General": {
"MinimumPasswordLength": 15,
"GitHubAccessToken": null,
@@ -9,7 +9,8 @@
"UseBasicWatchdog": false,
"UserLimit": 100,
"InstanceLimit": 10,
- "ValidInstancePaths": null
+ "ValidInstancePaths": null,
+ "HostApiDocumemtation": false
},
"FileLogging": {
"Directory": null,
diff --git a/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs b/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs
index 8d9d760faa..3d99525bdf 100644
--- a/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs
+++ b/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -144,6 +144,7 @@ namespace Tgstation.Server.Host.Setup.Tests
"-27",
"5000",
"fake token",
+ "y",
//logging config
"no",
//cp config
@@ -166,6 +167,7 @@ namespace Tgstation.Server.Host.Setup.Tests
String.Empty,
String.Empty,
"n",
+ "n",
//logging config
"y",
"not actually verified because lol mocks /../!@#$%^&*()/..///.",
@@ -189,6 +191,7 @@ namespace Tgstation.Server.Host.Setup.Tests
String.Empty,
String.Empty,
"y",
+ "y",
"will faile",
String.Empty,
String.Empty,