Skip to content

Commit

Permalink
feat(s3): add options to allow use custom instance (#1601)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Lee <[email protected]>
  • Loading branch information
vhashimotoo and malept authored Mar 31, 2020
1 parent 3a46a3b commit 38e63d1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/publisher/s3/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/publisher/s3/src/PublisherS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export default class PublisherS3 extends PublisherBase<PublisherS3Config> {
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,
});

if (!s3Client.config.credentials || !config.bucket) {
Expand Down

0 comments on commit 38e63d1

Please sign in to comment.