Skip to content

Commit

Permalink
feat(publisher-s3): Add sessionToken and change default fallback (#2984)
Browse files Browse the repository at this point in the history
  • Loading branch information
bboure committed Oct 27, 2022
1 parent 11a2f15 commit 72b80a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 10 additions & 2 deletions packages/publisher/s3/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ export interface PublisherS3Config {
/**
* Your AWS Access Key ID
*
* Falls back to the AWS_ACCESS_KEY_ID environment variable if not provided
* Falls back to the the default credential provider chain if not
* provided
*/
accessKeyId?: string;
/**
* The secret for your AWS Access Key
*
* Falls back to the AWS_SECRET_ACCESS_KEY environment variable if not
* Falls back to the the default credential provider chain if not
* provided
*/
secretAccessKey?: string;
/**
* The session token for your AWS Access Key
*
* Falls back to the the default credential provider chain if not
* provided
*/
sessionToken?: string;
/**
* The name of the S3 bucket to upload artifacts to
*/
Expand Down
7 changes: 4 additions & 3 deletions packages/publisher/s3/src/PublisherS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ export default class PublisherS3 extends PublisherBase<PublisherS3Config> {
}

generateCredentials(): Credentials | undefined {
const accessKeyId = this.config.accessKeyId || process.env.AWS_ACCESS_KEY_ID;
const secretAccessKey = this.config.secretAccessKey || process.env.AWS_SECRET_ACCESS_KEY;
const accessKeyId = this.config.accessKeyId;
const secretAccessKey = this.config.secretAccessKey;
const sessionToken = this.config.sessionToken;

if (accessKeyId && secretAccessKey) {
return { accessKeyId, secretAccessKey };
return { accessKeyId, secretAccessKey, sessionToken };
}

return undefined;
Expand Down

0 comments on commit 72b80a7

Please sign in to comment.