|
@@ -3,10 +3,11 @@ var AWS = require("aws-sdk"),
|
3
|
3
|
|
4
|
4
|
module.exports = function(bucket, storagePath) {
|
5
|
5
|
|
6
|
|
- var s3 = new AWS.S3({
|
7
|
|
- params: { Bucket: bucket },
|
8
|
|
- endpoint: process.env.S3_ENDPOINT || 's3.amazonaws.com'
|
9
|
|
- });
|
|
6
|
+ var s3Options = { params: { Bucket: bucket } };
|
|
7
|
+ if (process.env.S3_ENDPOINT) {
|
|
8
|
+ S3Options.endpoint = process.env.S3_ENDPOINT;
|
|
9
|
+ }
|
|
10
|
+ var s3 = new AWS.S3(s3Options);
|
10
|
11
|
|
11
|
12
|
// Test credentials
|
12
|
13
|
s3.headBucket({}, function(err){ if (err) { throw err; } });
|