diff --git a/package.json b/package.json index c5e5a10..0460835 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swrlab/node-storage-wrapper", - "version": "0.0.8", + "version": "0.0.9", "description": "Wrapping AWS S3, GCP GCS, file storage", "main": "./src/index.js", "engines": { diff --git a/src/index.js b/src/index.js index 0815181..6aa2f51 100644 --- a/src/index.js +++ b/src/index.js @@ -12,7 +12,7 @@ const { Storage } = require('@google-cloud/storage'); // create wrapper function StorageWrapper(config) { // check config - if (!config || !config.gs || !config.s3) { + if (!config || !config.gs) { return Promise.reject('storage config invalid'); } @@ -26,8 +26,10 @@ function StorageWrapper(config) { this.sdk.gs = new Storage(config.gs); // load aws sdk - AWS.config.loadFromPath(config.s3); - this.sdk.s3 = new AWS.S3(); + if (config.s3) { + AWS.config.loadFromPath(config.s3); + this.sdk.s3 = new AWS.S3(); + } // configure logging this.config = {