From 090b3d7e0f7e655353204e396e09a4c91c0893e0 Mon Sep 17 00:00:00 2001 From: Saiyan Abhishek <74703491+geeky-abhishek@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:30:28 +0530 Subject: [PATCH] feat: minio config updated --- packages/bff/src/minio/minio.service.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/bff/src/minio/minio.service.ts b/packages/bff/src/minio/minio.service.ts index 3fe581fb..539fa151 100644 --- a/packages/bff/src/minio/minio.service.ts +++ b/packages/bff/src/minio/minio.service.ts @@ -8,11 +8,17 @@ export class MinioService { public readonly minioClient: Minio.Client; constructor(private configService: ConfigService) { - const port = this.configService.get('MINIO_PORT'); + const url = this.configService.get('MINIO_URL'); + const parsedUrl = new URL(url); + + const requestType = parsedUrl?.protocol?.slice(0, -1); + const port = parsedUrl?.port; + const domain = parsedUrl?.hostname; + this.minioClient = new Minio.Client({ - endPoint: this.configService.get('MINIO_URL'), + endPoint: domain, port: Number(port), - useSSL: Number(port) === 443 ? true : false, + useSSL: requestType === 'https' ? true : false, accessKey: this.configService.get('MINIO_ACCESSKEY'), secretKey: this.configService.get('MINIO_SECRET'), });