diff --git a/backend/.env.development b/backend/.env.development index c6634bc2..84ee895a 100644 --- a/backend/.env.development +++ b/backend/.env.development @@ -68,6 +68,7 @@ LANGCHAIN_API_KEY=your_langsmith_api_key_here LANGCHAIN_PROJECT=your_langsmith_project_name_here # FILE_UPLOAD: Whether to enable file upload to storage +# Available options: false, s3, minio # If set to false, AWS_S3_BUCKET_NAME is not required. # Set to true if file upload is required. FILE_UPLOAD=true diff --git a/backend/docker/docker-compose-full.yml b/backend/docker/docker-compose-full.yml index 9e19bfaa..233ff1f3 100644 --- a/backend/docker/docker-compose-full.yml +++ b/backend/docker/docker-compose-full.yml @@ -26,7 +26,7 @@ services: LANGCHAIN_TRACING_V2: "false" LANGCHAIN_API_KEY: "your_langsmith_api_key_here" LANGCHAIN_PROJECT: "your_langsmith_project_name_here" - FILE_UPLOAD: true + FILE_UPLOAD: false AWS_REGION: "your_aws_region_here" # Default configuration values for using Minio BUCKET_NAME: "default-storage" diff --git a/backend/src/storage/storage.module.ts b/backend/src/storage/storage.module.ts index ce18a69a..b75a261a 100644 --- a/backend/src/storage/storage.module.ts +++ b/backend/src/storage/storage.module.ts @@ -5,7 +5,7 @@ import { ConfigService } from "@nestjs/config"; const s3ClientFactory = { provide: "STORAGE_CLIENT", useFactory: (configService: ConfigService): S3Client | null => { - const fileUpload = configService.get("FILE_UPLOAD"); + const fileUpload = configService.get("FILE_UPLOAD"); if (!fileUpload) { return null; } @@ -14,19 +14,17 @@ const s3ClientFactory = { const accessKeyId = configService.get("STORAGE_ACCESS_KEY"); const secretAccessKey = configService.get("STORAGE_SECRET_KEY"); - const config: S3ClientConfig = fileUpload - ? { - region, - endpoint, - forcePathStyle: true, - credentials: { - accessKeyId, - secretAccessKey, - }, - } - : { - region, - }; + const config: S3ClientConfig = { + region, + ...(fileUpload === "minio" && { + endpoint, + forcePathStyle: true, + credentials: { + accessKeyId, + secretAccessKey, + }, + }), + }; return new S3Client(config); },