Bläddra i källkod

fix(asset-server-plugin): Make S3 credentials optional

Closes #733
Michael Bromley 4 år sedan
förälder
incheckning
56bcbffb0c
1 ändrade filer med 5 tillägg och 3 borttagningar
  1. 5 3
      packages/asset-server-plugin/src/s3-asset-storage-strategy.ts

+ 5 - 3
packages/asset-server-plugin/src/s3-asset-storage-strategy.ts

@@ -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.
@@ -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);