Skip to content

Commit

Permalink
Add BackendBaseRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
tsundvoll committed Apr 18, 2023
1 parent 473e104 commit 1de49ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion backend/api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Identity.Web;
using Microsoft.OpenApi.Models;

var builder = WebApplication.CreateBuilder(args);

Expand Down Expand Up @@ -87,7 +88,15 @@

var app = builder.Build();

app.UseSwagger();

string basePath = builder.Configuration["BackendBaseRoute"];
app.UseSwagger(c =>
{
c.PreSerializeFilters.Add((swaggerDoc, httpReq) =>
{
swaggerDoc.Servers = new List<OpenApiServer> { new OpenApiServer { Url = $"{httpReq.Scheme}://{httpReq.Host.Value}{basePath}" } };
});
});
app.UseSwaggerUI(
c =>
{
Expand Down
3 changes: 2 additions & 1 deletion backend/api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
},
"KeyVault": {
"UseKeyVault": true
}
},
"BackendBaseRoute": ""

}

0 comments on commit 1de49ad

Please sign in to comment.