From 09adacb788f234efa6e4e26c145cfe1f1861d181 Mon Sep 17 00:00:00 2001 From: dineshsalunke Date: Wed, 27 May 2020 08:42:27 +0530 Subject: [PATCH] feat(s3options and configloader): support digitalocean spaces Since digital ocean spaces uses aws sdk and api itself, exposing just the endpoint property so we can use as the remote --- lib/interfaces/multer-extended-s3-options.interface.ts | 4 ++++ lib/multer-config.loader.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/interfaces/multer-extended-s3-options.interface.ts b/lib/interfaces/multer-extended-s3-options.interface.ts index 82cdab6d..25eecac9 100644 --- a/lib/interfaces/multer-extended-s3-options.interface.ts +++ b/lib/interfaces/multer-extended-s3-options.interface.ts @@ -1,6 +1,10 @@ import { LoggerService } from '@nestjs/common'; export interface MulterExtendedS3Options { + /* + * AWS Endpoint + */ + readonly endpoint?: string; /** * AWS Access Key ID */ diff --git a/lib/multer-config.loader.ts b/lib/multer-config.loader.ts index c5e13934..6c9f9e8c 100644 --- a/lib/multer-config.loader.ts +++ b/lib/multer-config.loader.ts @@ -24,7 +24,9 @@ export class MulterConfigLoader implements MulterS3ConfigService { region: s3Options.region || MulterConfigLoader.DEFAULT_REGION, }); - this.S3 = new AWS.S3(); + this.S3 = new AWS.S3({ + endpoint: s3Options.endpoint, + }); this.logger = s3Options.logger || new Logger(MulterConfigLoader.name); this.logger.log(JSON.stringify(s3Options)); }