From 7f28f64cbee676ce289a8c00c37b23c73fc68e29 Mon Sep 17 00:00:00 2001 From: Qstick Date: Tue, 28 Dec 2021 18:47:44 -0600 Subject: [PATCH] Fix server settings on API docs --- src/NzbDrone.Host/Startup.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Host/Startup.cs b/src/NzbDrone.Host/Startup.cs index bd3a0ad7b..40b375ada 100644 --- a/src/NzbDrone.Host/Startup.cs +++ b/src/NzbDrone.Host/Startup.cs @@ -140,6 +140,16 @@ namespace NzbDrone.Host }, }; + c.AddServer(new OpenApiServer + { + Url = "{protocol}://{hostpath}", + Variables = new Dictionary + { + { "protocol", new OpenApiServerVariable { Default = "http", Enum = new List { "http", "https" } } }, + { "hostpath", new OpenApiServerVariable { Default = "localhost:9696" } } + } + }); + c.AddSecurityDefinition("apikey", apikeyQuery); c.AddSecurityRequirement(new OpenApiSecurityRequirement @@ -244,11 +254,6 @@ namespace NzbDrone.Host { app.UseSwagger(c => { - c.PreSerializeFilters.Add((swagger, httpReq) => - { - swagger.Servers = new List { new OpenApiServer { Url = $"{httpReq.Scheme}://{httpReq.Host.Value}" } }; - }); - c.RouteTemplate = "docs/{documentName}/openapi.json"; }); }