diff --git a/.env-template b/.env-template index d6036a5ec..1907b2f18 100644 --- a/.env-template +++ b/.env-template @@ -51,3 +51,4 @@ MINIO_SECRET_KEY= MINIO_ENDPOINT= MINIO_BUCKET_NAME= MINIO_PORT= +MINIO_URL= diff --git a/src/config.ts b/src/config.ts index 5204ef558..2de67b75f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -56,4 +56,5 @@ export const config = { MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY ?? '', MINIO_PORT: process.env.MINIO_PORT ? parseInt(process.env.MINIO_PORT) : 9000, MINIO_BUCKET_NAME: process.env.MINIO_BUCKET_NAME ?? '', + MINIO_URL: process.env.MINIO_URL ?? 'localhost:9000', }; diff --git a/src/utils/upload.ts b/src/utils/upload.ts index 9c2d3c354..63cc4319c 100644 --- a/src/utils/upload.ts +++ b/src/utils/upload.ts @@ -67,9 +67,9 @@ export async function upload( if (minioClient) { try { const bucketName = config.MINIO_BUCKET_NAME; - const objectName = formattedFilePath; + const objectName = uploadFilePath; await minioClient.fPutObject(bucketName, objectName, formattedFilePath); - const url = `${config.MINIO_ENDPOINT}:${config.MINIO_PORT}/${config.MINIO_BUCKET_NAME}/${objectName}`; + const url = `${config.MINIO_URL}/${objectName}`; result = url; } catch (error) { console.error(error);