diff --git a/server/src/integrations/environment/environment.service.ts b/server/src/integrations/environment/environment.service.ts index 1c7acea16..399398b36 100644 --- a/server/src/integrations/environment/environment.service.ts +++ b/server/src/integrations/environment/environment.service.ts @@ -115,7 +115,11 @@ export class EnvironmentService { } getStorageS3Name(): string | undefined { - return this.configService.get('STORAGE_S3_NAME'); + return this.configService.get('STORAGE_S3_NAME'); + } + + getStorageS3Endpoint(): string | undefined { + return this.configService.get('STORAGE_S3_ENDPOINT'); } getStorageLocalPath(): string { diff --git a/server/src/integrations/file-storage/drivers/s3.driver.ts b/server/src/integrations/file-storage/drivers/s3.driver.ts index d2eaa929d..1379268c2 100644 --- a/server/src/integrations/file-storage/drivers/s3.driver.ts +++ b/server/src/integrations/file-storage/drivers/s3.driver.ts @@ -14,6 +14,7 @@ import { StorageDriver } from './interfaces/storage-driver.interface'; export interface S3DriverOptions extends S3ClientConfig { bucketName: string; + endpoint?: string; region: string; } @@ -22,13 +23,13 @@ export class S3Driver implements StorageDriver { private bucketName: string; constructor(options: S3DriverOptions) { - const { bucketName, region, ...s3Options } = options; + const { bucketName, region, endpoint, ...s3Options } = options; if (!bucketName || !region) { return; } - this.s3Client = new S3({ ...s3Options, region }); + this.s3Client = new S3({ ...s3Options, region, endpoint }); this.bucketName = bucketName; } diff --git a/server/src/integrations/integrations.module.ts b/server/src/integrations/integrations.module.ts index 84206f1da..86bbde6d3 100644 --- a/server/src/integrations/integrations.module.ts +++ b/server/src/integrations/integrations.module.ts @@ -34,12 +34,14 @@ const fileStorageModuleFactory = async ( } case StorageType.S3: { const bucketName = environmentService.getStorageS3Name(); + const endpoint = environmentService.getStorageS3Endpoint(); const region = environmentService.getStorageS3Region(); return { type: StorageType.S3, options: { bucketName: bucketName ?? '', + endpoint: endpoint, credentials: fromNodeProviderChain({ clientConfig: { region }, }),