Skip to content

Commit

Permalink
fix(asset-server-plugin): Make S3 credentials optional
Browse files Browse the repository at this point in the history
Closes #733
  • Loading branch information
michaelbromley committed Mar 15, 2021
1 parent e92d2ce commit 56bcbff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/asset-server-plugin/src/s3-asset-storage-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export interface S3Config {
* The credentials used to access your s3 account. You can supply either the access key ID & secret,
* or you can make use of a
* [shared credentials file](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html)
* and supply the profile name (e.g. `'default'`)
* and supply the profile name (e.g. `'default'`).
*/
credentials: S3Credentials | S3CredentialsProfile;
credentials?: S3Credentials | S3CredentialsProfile;
/**
* @description
* The S3 bucket in which to store the assets. If it does not exist, it will be created on startup.
Expand Down Expand Up @@ -245,7 +245,9 @@ export class S3AssetStorageStrategy implements AssetStorageStrategy {

private getS3Credentials() {
const { credentials } = this.s3Config;
if (this.isCredentialsProfile(credentials)) {
if (credentials == null) {
return null;
} else if (this.isCredentialsProfile(credentials)) {
return new this.AWS.SharedIniFileCredentials(credentials);
}
return new this.AWS.Credentials(credentials);
Expand Down

0 comments on commit 56bcbff

Please sign in to comment.