end
continuous-integration/drone/push Build is passing Details

pull/10/head
David D'ALMEIDA 1 year ago
parent d20f23478f
commit 4e6ab80d58

@ -172,7 +172,6 @@ public class AppBootstrap(IConfiguration configuration)
public void Configure(WebApplication app, IWebHostEnvironment env) public void Configure(WebApplication app, IWebHostEnvironment env)
{ {
// app.UsePathBase("/containers/HeartDev-api");
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.MapIdentityApi<IdentityUser>(); app.MapIdentityApi<IdentityUser>();
@ -189,29 +188,24 @@ public class AppBootstrap(IConfiguration configuration)
{ {
options.PreSerializeFilters.Add((swagger, httpReq) => options.PreSerializeFilters.Add((swagger, httpReq) =>
{ {
//if (httpReq.Headers.ContainsKey("X-Forwarded-Host")) if (httpReq.Headers.ContainsKey("X-Forwarded-Host"))
// { {
//The httpReq.PathBase and httpReq.Headers["X-Forwarded-Prefix"] is what we need to get the base path.
//For some reason, they returning as null/blank. Perhaps this has something to do with how the proxy is configured which we don't have control.
//For the time being, the base path is manually set here that corresponds to the APIM API Url Prefix.
//In this case we set it to 'sample-app'.
var basePath = "containers/HeartDev-api"; var basePath = "containers/HeartDev-api";
var serverUrl = $"{httpReq.Scheme}://{httpReq.Headers["X-Forwarded-Host"]}/3{basePath}"; var serverUrl = $"{httpReq.Scheme}://{httpReq.Headers["X-Forwarded-Host"]}/3{basePath}";
swagger.Servers = new List<OpenApiServer> { new() { Url = serverUrl }, new() { Url = $"{httpReq.Scheme}://1{httpReq.Host.Value}" },new() { Url = $"{httpReq.Scheme}://2{httpReq.Host.Value}/{basePath}" } }; swagger.Servers = new List<OpenApiServer> { new() { Url = serverUrl } };
//} }
}); });
}); });
app.UseSwaggerUI(); app.UseSwaggerUI();
app.MapSwagger(); app.MapSwagger();
/* app.UseSwaggerUI(options => app.UseSwaggerUI(options =>
{ {
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions) foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
{ {
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json", options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
description.GroupName.ToUpperInvariant()); description.GroupName.ToUpperInvariant());
} }
});*/ });
} }

Loading…
Cancel
Save