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'), });