From 6025e180bda2e6db298343fcace261d7ea4a7895 Mon Sep 17 00:00:00 2001 From: Luke Petre Date: Fri, 25 Sep 2015 15:48:32 +0100 Subject: [PATCH] Support passing a valid s3client via config --- index.js | 3 +++ lib/s3.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e3cd3ca..0477969 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,9 @@ module.exports = { revisionKey: function(context) { var revisionKey = context.revisionData && context.revisionData.revisionKey; return context.commandOptions.revision || revisionKey; + }, + s3Client: function(context) { + return context.s3Client; // if you want to provide your own S3 client to be used instead of one from aws-sdk } }, requiredConfig: ['accessKeyId', 'secretAccessKey', 'bucket'], diff --git a/lib/s3.js b/lib/s3.js index a32e7bc..a2911f3 100644 --- a/lib/s3.js +++ b/lib/s3.js @@ -8,7 +8,7 @@ module.exports = CoreObject.extend({ var config = plugin.pluginConfig; var readConfig = plugin.readConfig; - this._client = new AWS.S3(config); + this._client = plugin.readConfig('s3Client') || new AWS.S3(config); this._bucket = plugin.readConfig('bucket'); this._keyPrefix = plugin.readConfig('keyPrefix'); this._filePattern = plugin.readConfig('filePattern');