From 05c2d70475a9b60a6c4e818d809defed5b516958 Mon Sep 17 00:00:00 2001 From: HashimotoYT Date: Tue, 31 Mar 2020 21:14:32 +0000 Subject: [PATCH 1/2] feat(s3): add options to allow use custom instance --- packages/publisher/s3/src/Config.ts | 18 ++++++++++++++++++ packages/publisher/s3/src/PublisherS3.ts | 3 +++ 2 files changed, 21 insertions(+) diff --git a/packages/publisher/s3/src/Config.ts b/packages/publisher/s3/src/Config.ts index d5310af83a..7204757cbb 100644 --- a/packages/publisher/s3/src/Config.ts +++ b/packages/publisher/s3/src/Config.ts @@ -31,6 +31,24 @@ export interface PublisherS3Config { * Default: false */ public?: boolean; + /** + * The endpoint URI to send requests to. + * + * E.g. `https://s3.example.com` + */ + endpoint?: string; + /** + * The region to send service requests to. + * + * E.g. `eu-west-1` + */ + region?: string; + /** + * Whether to force path style URLs for S3 objects. + * + * Default: false + */ + s3ForcePathStyle?: boolean; /** * Custom function to provide the key to upload a given file to */ diff --git a/packages/publisher/s3/src/PublisherS3.ts b/packages/publisher/s3/src/PublisherS3.ts index 676a24b842..b0651cf6d8 100644 --- a/packages/publisher/s3/src/PublisherS3.ts +++ b/packages/publisher/s3/src/PublisherS3.ts @@ -38,6 +38,9 @@ export default class PublisherS3 extends PublisherBase { const s3Client = new S3({ accessKeyId: config.accessKeyId || process.env.AWS_ACCESS_KEY_ID, secretAccessKey: config.secretAccessKey || process.env.AWS_SECRET_ACCESS_KEY, + region: config.region || undefined, + endpoint: config.endpoint || undefined, + s3ForcePathStyle: config.s3ForcePathStyle || false, }); if (!s3Client.config.credentials || !config.bucket) { From 27aab14218bde2f2af049f38eb6f4f438ef6f642 Mon Sep 17 00:00:00 2001 From: Vlad Hashimoto Date: Wed, 1 Apr 2020 00:42:38 +0300 Subject: [PATCH 2/2] Update packages/publisher/s3/src/PublisherS3.ts Co-Authored-By: Mark Lee --- packages/publisher/s3/src/PublisherS3.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/publisher/s3/src/PublisherS3.ts b/packages/publisher/s3/src/PublisherS3.ts index b0651cf6d8..c604c3dc96 100644 --- a/packages/publisher/s3/src/PublisherS3.ts +++ b/packages/publisher/s3/src/PublisherS3.ts @@ -40,7 +40,7 @@ export default class PublisherS3 extends PublisherBase { secretAccessKey: config.secretAccessKey || process.env.AWS_SECRET_ACCESS_KEY, region: config.region || undefined, endpoint: config.endpoint || undefined, - s3ForcePathStyle: config.s3ForcePathStyle || false, + s3ForcePathStyle: !!config.s3ForcePathStyle, }); if (!s3Client.config.credentials || !config.bucket) {