Skip to content

Commit

Permalink
making s3 optional
Browse files Browse the repository at this point in the history
  • Loading branch information
frytg committed Aug 5, 2020
1 parent 84530fd commit 86c6dcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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 = {
Expand Down

0 comments on commit 86c6dcc

Please sign in to comment.