mirror of
https://github.com/bitwarden/server.git
synced 2025-04-09 15:18:13 -05:00
Update swagger config to use proper URL scheme (#744)
This commit is contained in:
parent
343ef92a20
commit
beb40eb682
@ -86,7 +86,7 @@ build_script:
|
|||||||
$env:swaggerGen = "true"
|
$env:swaggerGen = "true"
|
||||||
$env:ASPNETCORE_ENVIRONMENT = "Production"
|
$env:ASPNETCORE_ENVIRONMENT = "Production"
|
||||||
cd .\src\Api
|
cd .\src\Api
|
||||||
dotnet swagger tofile --output ..\..\swagger.json --host api.bitwarden.com `
|
dotnet swagger tofile --output ..\..\swagger.json --host https://api.bitwarden.com `
|
||||||
.\bin\Debug\netcoreapp3.1\Api.dll public
|
.\bin\Debug\netcoreapp3.1\Api.dll public
|
||||||
cd ..\..
|
cd ..\..
|
||||||
$env:ASPNETCORE_ENVIRONMENT = ""
|
$env:ASPNETCORE_ENVIRONMENT = ""
|
||||||
|
@ -188,12 +188,10 @@ namespace Bit.Api
|
|||||||
app.UseSwagger(config =>
|
app.UseSwagger(config =>
|
||||||
{
|
{
|
||||||
config.RouteTemplate = "specs/{documentName}/swagger.json";
|
config.RouteTemplate = "specs/{documentName}/swagger.json";
|
||||||
var host = globalSettings.BaseServiceUri.Api.Replace("https://", string.Empty)
|
|
||||||
.Replace("http://", string.Empty);
|
|
||||||
config.PreSerializeFilters.Add((swaggerDoc, httpReq) =>
|
config.PreSerializeFilters.Add((swaggerDoc, httpReq) =>
|
||||||
swaggerDoc.Servers = new List<OpenApiServer>
|
swaggerDoc.Servers = new List<OpenApiServer>
|
||||||
{
|
{
|
||||||
new OpenApiServer { Url = $"{httpReq.Scheme}://{host}" }
|
new OpenApiServer { Url = globalSettings.BaseServiceUri.Api }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
app.UseSwaggerUI(config =>
|
app.UseSwaggerUI(config =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user