From c94f7cab51a0742ce947bcec121b812c2d0abe15 Mon Sep 17 00:00:00 2001 From: joaoMiraya Date: Tue, 24 Feb 2026 23:30:50 -0300 Subject: [PATCH 1/4] fix: redirect swagger fixed Signed-off-by: joaoMiraya --- apps/api-gateway/src/app.controller.ts | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/apps/api-gateway/src/app.controller.ts b/apps/api-gateway/src/app.controller.ts index a778b44ba..027ce1611 100644 --- a/apps/api-gateway/src/app.controller.ts +++ b/apps/api-gateway/src/app.controller.ts @@ -1,10 +1,26 @@ -import { Controller, Logger } from '@nestjs/common'; -import { ApiBearerAuth } from '@nestjs/swagger'; +import { Controller, Get, Logger, Redirect } from '@nestjs/common'; +import { ApiBearerAuth, ApiExcludeEndpoint } from '@nestjs/swagger'; import { AppService } from './app.service'; +import { ConfigService } from '@credebl/config/config.service'; + @Controller() @ApiBearerAuth() -export class AppController { - constructor(private readonly appService: AppService) {} +export class AppController { + constructor( + private readonly appService: AppService, + private readonly configService: ConfigService + ) {} + + private readonly logger = new Logger('AppController'); + + @Get() + @Redirect('/api', 301) + @ApiExcludeEndpoint() + redirectToSwagger(): { url?: string; statusCode: number } { + if (this.configService.isDevelopment) { + return { url: '/api', statusCode: 301 }; + } - private readonly logger = new Logger('AppController'); + return { statusCode: 200 }; + } } From 77773e96d109083cf65eb94451e11cfec1fe7b64 Mon Sep 17 00:00:00 2001 From: joaoMiraya Date: Thu, 30 Jul 2026 22:04:44 -0300 Subject: [PATCH 2/4] fix: set env var to expose swagger endpoint Signed-off-by: joaoMiraya --- .env.demo | 4 +++- .env.sample | 4 +++- apps/api-gateway/src/app.controller.ts | 2 +- libs/config/src/config.service.ts | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.env.demo b/.env.demo index 18d5d2bd1..c85d2e8f1 100644 --- a/.env.demo +++ b/.env.demo @@ -244,4 +244,6 @@ CONSUMER_CONFIG_MAX_DELIVER=4 AGGREGATE_STREAM=aggregate DID_STREAM=did-notify -PULL_CONSUMER=hub-pull-consumer \ No newline at end of file +PULL_CONSUMER=hub-pull-consumer + +ENABLE_SWAGGER=true diff --git a/.env.sample b/.env.sample index 823432c7d..59503c9dc 100644 --- a/.env.sample +++ b/.env.sample @@ -272,4 +272,6 @@ CONSUMER_CONFIG_MAX_DELIVER=4 AGGREGATE_STREAM=aggregate DID_STREAM=did-notify -PULL_CONSUMER=hub-pull-consumer \ No newline at end of file +PULL_CONSUMER=hub-pull-consumer + +ENABLE_SWAGGER=true diff --git a/apps/api-gateway/src/app.controller.ts b/apps/api-gateway/src/app.controller.ts index 027ce1611..e061fa630 100644 --- a/apps/api-gateway/src/app.controller.ts +++ b/apps/api-gateway/src/app.controller.ts @@ -17,7 +17,7 @@ export class AppController { @Redirect('/api', 301) @ApiExcludeEndpoint() redirectToSwagger(): { url?: string; statusCode: number } { - if (this.configService.isDevelopment) { + if (this.configService.isSwaggerAvailable) { return { url: '/api', statusCode: 301 }; } diff --git a/libs/config/src/config.service.ts b/libs/config/src/config.service.ts index f94305b82..38a0acd0f 100644 --- a/libs/config/src/config.service.ts +++ b/libs/config/src/config.service.ts @@ -25,4 +25,8 @@ export class ConfigService { private get environment(): string { return this.configService.get('NODE_ENV'); } + + get isSwaggerAvailable(): boolean { + return this.configService.get('ENABLE_SWAGGER'); + } } From 7dcb84c3dc3804360cb8246ba4aaa3a2c9b08e5d Mon Sep 17 00:00:00 2001 From: joaoMiraya Date: Fri, 31 Jul 2026 21:35:01 -0300 Subject: [PATCH 3/4] fix: fix redirect status and bool check Signed-off-by: joaoMiraya --- .env.demo | 4 +--- .env.sample | 4 +--- apps/api-gateway/src/app.controller.ts | 4 ++-- libs/config/src/config.service.ts | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.env.demo b/.env.demo index c85d2e8f1..18d5d2bd1 100644 --- a/.env.demo +++ b/.env.demo @@ -244,6 +244,4 @@ CONSUMER_CONFIG_MAX_DELIVER=4 AGGREGATE_STREAM=aggregate DID_STREAM=did-notify -PULL_CONSUMER=hub-pull-consumer - -ENABLE_SWAGGER=true +PULL_CONSUMER=hub-pull-consumer \ No newline at end of file diff --git a/.env.sample b/.env.sample index 59503c9dc..823432c7d 100644 --- a/.env.sample +++ b/.env.sample @@ -272,6 +272,4 @@ CONSUMER_CONFIG_MAX_DELIVER=4 AGGREGATE_STREAM=aggregate DID_STREAM=did-notify -PULL_CONSUMER=hub-pull-consumer - -ENABLE_SWAGGER=true +PULL_CONSUMER=hub-pull-consumer \ No newline at end of file diff --git a/apps/api-gateway/src/app.controller.ts b/apps/api-gateway/src/app.controller.ts index e061fa630..c28b7d101 100644 --- a/apps/api-gateway/src/app.controller.ts +++ b/apps/api-gateway/src/app.controller.ts @@ -14,11 +14,11 @@ export class AppController { private readonly logger = new Logger('AppController'); @Get() - @Redirect('/api', 301) + @Redirect('/api', 302) @ApiExcludeEndpoint() redirectToSwagger(): { url?: string; statusCode: number } { if (this.configService.isSwaggerAvailable) { - return { url: '/api', statusCode: 301 }; + return { url: '/api', statusCode: 302 }; } return { statusCode: 200 }; diff --git a/libs/config/src/config.service.ts b/libs/config/src/config.service.ts index 38a0acd0f..2d5044990 100644 --- a/libs/config/src/config.service.ts +++ b/libs/config/src/config.service.ts @@ -27,6 +27,6 @@ export class ConfigService { } get isSwaggerAvailable(): boolean { - return this.configService.get('ENABLE_SWAGGER'); + return 'true' === this.configService.get('ENABLE_SWAGGER'); } } From 412adf677513917fa0ad407f0599866c546cf7b7 Mon Sep 17 00:00:00 2001 From: joaoMiraya Date: Wed, 19 Aug 2026 22:03:16 -0300 Subject: [PATCH 4/4] chore: add env var on .env.demo Signed-off-by: joaoMiraya --- .env.demo | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.env.demo b/.env.demo index 18d5d2bd1..86dbddedf 100644 --- a/.env.demo +++ b/.env.demo @@ -244,4 +244,6 @@ CONSUMER_CONFIG_MAX_DELIVER=4 AGGREGATE_STREAM=aggregate DID_STREAM=did-notify -PULL_CONSUMER=hub-pull-consumer \ No newline at end of file +PULL_CONSUMER=hub-pull-consumer + +ENABLE_SWAGGER=true \ No newline at end of file