From b5654962347819f6fc5403732541a7a44c9b5a81 Mon Sep 17 00:00:00 2001 From: Daniel Freytag Date: Thu, 13 Aug 2020 19:58:30 +0200 Subject: [PATCH] breaking change where s3 credentials need to be handed over --- package.json | 2 +- src/index.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a7929a4..ef99871 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swrlab/node-storage-wrapper", - "version": "0.0.10", + "version": "0.0.11", "description": "Wrapping AWS S3, GCP GCS, file storage", "main": "./src/index.js", "engines": { diff --git a/src/index.js b/src/index.js index 6aa2f51..413aec1 100644 --- a/src/index.js +++ b/src/index.js @@ -27,8 +27,7 @@ function StorageWrapper(config) { // load aws sdk if (config.s3) { - AWS.config.loadFromPath(config.s3); - this.sdk.s3 = new AWS.S3(); + this.sdk.s3 = new AWS.S3(config.s3); } // configure logging @@ -60,7 +59,14 @@ function StorageWrapper(config) { this.save = require('./save'); // log progress - this.sdk.log(this, 'log', ['storage.index', 'loaded config >', JSON.stringify({ config })]); + this.sdk.log(this, 'log', [ + 'storage.index', + 'loaded config', + JSON.stringify({ + gs: config.gs ? config.gs.projectId : null, + s3: config.s3 ? { accessKeyId: config.s3.accessKeyId, region: config.s3.region } : null, + }), + ]); } // export