Browse Source

only set S3 endpoint if it's defined

Michael Strickland 7 years ago
parent
commit
821269836f
1 changed files with 5 additions and 4 deletions
  1. 5 4
      lib/transports/s3/remote.js

+ 5 - 4
lib/transports/s3/remote.js View File

@@ -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; } });