Browse Source

fix: host name correction in swagger json ( related #166 )

pull/189/head
“pranavxc” 3 years ago
parent
commit
44a427b9da
  1. 4
      packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts

4
packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts

@ -1503,12 +1503,12 @@ export class RestApiBuilder extends BaseApiBuilder<Noco> {
}));
});
this.router.get(`/${this.getDbAlias()}/swagger.json`, async (_req, res) => {
this.router.get(`/${this.getDbAlias()}/swagger.json`, async (req, res) => {
// todo: optimize
let swaggerBaseDocument: any = JSON.parse(JSON.stringify(await import('./ui/auth/swagger-base.xc.json')));
if (this.config?.auth?.jwt?.dbAlias !== this.connectionConfig.meta.dbAlias) {
swaggerBaseDocument = {...swaggerBaseDocument, tags: [], definitions: {}, paths: {}};
swaggerBaseDocument = {...swaggerBaseDocument, tags: [], definitions: {}, paths: {}, host: req.get('host')};
}
glob.sync(path.join(this.config.toolDir, 'nc', this.projectId, this.getDbAlias(), 'swagger', 'swagger.json')).forEach(jsonFile => {

Loading…
Cancel
Save