diff --git a/lib/fileHandler/index.js b/lib/fileHandler/index.js index ca54b3ad..ab604ba2 100644 --- a/lib/fileHandler/index.js +++ b/lib/fileHandler/index.js @@ -73,7 +73,7 @@ module.exports = function (options) { //Setup params for `s3.upload` method var uploadParams = { - Bucket: BUCKET, + Bucket: params.bucket || BUCKET, Key: fileGuidName, ContentType: mimeType, ContentLength: params.length @@ -101,7 +101,7 @@ module.exports = function (options) { } - var s3 = new AWS.S3({ region: REGION }); + var s3 = new AWS.S3({ region: params.region || REGION }); s3.upload(uploadParams, function (fileUploadError, data) { @@ -116,7 +116,7 @@ module.exports = function (options) { s3.getSignedUrl( 'getObject', { - Bucket: BUCKET, + Bucket: params.bucket || BUCKET, Key: fileGuidName, Expires: twentyFourHourPeriod.unix() - moment().unix() }, @@ -199,7 +199,7 @@ module.exports = function (options) { var mimeType = params.contentType || mime.lookup(params.name); var uploadParams = { - Bucket: BUCKET, + Bucket: params.bucket || BUCKET, Key: fileGuidName, ContentType: mimeType, Body: params.readStream @@ -209,7 +209,7 @@ module.exports = function (options) { uploadParams.ContentLength = params.length; } - var s3 = new AWS.S3({ region: REGION }); + var s3 = new AWS.S3({ region: params.region || REGION }); s3.upload( uploadParams, @@ -226,7 +226,7 @@ module.exports = function (options) { s3.getSignedUrl( 'getObject', { - Bucket: BUCKET, + Bucket: params.bucket || BUCKET, Key: fileGuidName, Expires: twentyFourHourPeriod.unix() - moment().unix() },