mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-21 04:10:52 +02:00
Fix server settings on API docs
This commit is contained in:
parent
9bad31af84
commit
7f28f64cbe
1 changed files with 10 additions and 5 deletions
|
|
@ -140,6 +140,16 @@ public void ConfigureServices(IServiceCollection services)
|
|||
},
|
||||
};
|
||||
|
||||
c.AddServer(new OpenApiServer
|
||||
{
|
||||
Url = "{protocol}://{hostpath}",
|
||||
Variables = new Dictionary<string, OpenApiServerVariable>
|
||||
{
|
||||
{ "protocol", new OpenApiServerVariable { Default = "http", Enum = new List<string> { "http", "https" } } },
|
||||
{ "hostpath", new OpenApiServerVariable { Default = "localhost:9696" } }
|
||||
}
|
||||
});
|
||||
|
||||
c.AddSecurityDefinition("apikey", apikeyQuery);
|
||||
|
||||
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||
|
|
@ -244,11 +254,6 @@ public void Configure(IApplicationBuilder app,
|
|||
{
|
||||
app.UseSwagger(c =>
|
||||
{
|
||||
c.PreSerializeFilters.Add((swagger, httpReq) =>
|
||||
{
|
||||
swagger.Servers = new List<OpenApiServer> { new OpenApiServer { Url = $"{httpReq.Scheme}://{httpReq.Host.Value}" } };
|
||||
});
|
||||
|
||||
c.RouteTemplate = "docs/{documentName}/openapi.json";
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue