Skip to content

Commit

Permalink
reverted swagger backend baseURL change and instead fix frontend swag…
Browse files Browse the repository at this point in the history
…ger client
  • Loading branch information
maximiliancsuk committed May 21, 2024
1 parent 0bbcf48 commit 6ae619d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/Omnikeeper/Startup/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApp

app.UseSwagger(c =>
{
c.RouteTemplate = $"{Configuration["BaseURL"]}/swagger/{{documentName}}/swagger.json";
c.RouteTemplate = "swagger/{documentName}/swagger.json";
// TODO: still needed? breaks swagger behind (certain) revery proxies, if commented in
//c.PreSerializeFilters.Add((swaggerDoc, httpReq) =>
//{
Expand Down
8 changes: 8 additions & 0 deletions frontend/core/src/utils/useSwaggerClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export default function useSwaggerClient() {
oauth2: { token: { access_token: token } },
}
}).then(d => {

// NOTE: we set the servers array explicitly, because - depending on the backend config and overall config (proxy, ...) - we cannot rely on the default set by swagger.json
d.spec.servers = [
{
"url": `${env('BACKEND_URL')}`
}
]

setSwaggerClient(d);
setLoading(false);
}).catch(e => {
Expand Down

0 comments on commit 6ae619d

Please sign in to comment.