update minio endpoint

This commit is contained in:
2024-10-14 23:44:10 +07:00
parent 65b0462b01
commit ab8ae5d8d3
3 changed files with 6 additions and 3 deletions

View File

@@ -19,6 +19,8 @@ services:
- SWAGGER_PATH=/swagger - SWAGGER_PATH=/swagger
- API_PATH=/v1 - API_PATH=/v1
- MINIO_API_URL=https://objects.epess.org - MINIO_API_URL=https://objects.epess.org
- MINIO_BUCKET_NAME=epess
- MINIO_ACCESS_KEY=71dNgJtzkelXtG3R6IVt - MINIO_ACCESS_KEY=71dNgJtzkelXtG3R6IVt
- MINIO_SECRET_KEY=53LmFiDCZxvflJIOsVF9cf0aqkIjNU2oOWtLzGsf - MINIO_SECRET_KEY=53LmFiDCZxvflJIOsVF9cf0aqkIjNU2oOWtLzGsf
labels: labels:

View File

@@ -10,8 +10,7 @@ import { ConfigModule } from '@nestjs/config';
endPoint: process.env.MINIO_ENDPOINT ?? '10.0.27.1', endPoint: process.env.MINIO_ENDPOINT ?? '10.0.27.1',
accessKey: process.env.MINIO_ACCESS_KEY ?? 'minioadmin', accessKey: process.env.MINIO_ACCESS_KEY ?? 'minioadmin',
secretKey: process.env.MINIO_SECRET_KEY ?? 'minioadmin', secretKey: process.env.MINIO_SECRET_KEY ?? 'minioadmin',
useSSL: false, useSSL: true,
port: 9000,
}), }),
], ],
providers: [MinioService], providers: [MinioService],

View File

@@ -28,12 +28,14 @@ export class MinioService {
} }
async getFileUrl(fileName: string, category: string) { async getFileUrl(fileName: string, category: string) {
return await this.minioClient.presignedUrl( const url = await this.minioClient.presignedUrl(
'GET', 'GET',
this.configService.get('BUCKET_NAME') ?? 'epess', this.configService.get('BUCKET_NAME') ?? 'epess',
`${category}/${fileName}`, `${category}/${fileName}`,
3600, 3600,
); );
// replace the url with the url with actual url
return url;
} }
async deleteFile(fileName: string) { async deleteFile(fileName: string) {