Skip to content

Commit

Permalink
Support for custom endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Kalinin committed Apr 4, 2019
1 parent 78739ae commit 6b7470a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
var s3 = new (require('aws-sdk')).S3({ params: { Bucket: process.env.S3_BUCKET_NAME } });
var AWS = require('aws-sdk')

var s3_options = { params: { Bucket: process.env.S3_BUCKET_NAME } }

// if (process.env.S3_REGION)
// s3_options.region = process.env.S3_REGION
if (process.env.S3_ENDPOINT)
s3_options.endpoint = new AWS.Endpoint(process.env.S3_ENDPOINT)

var s3 = new AWS.S3(s3_options);

module.exports = {

Expand Down Expand Up @@ -55,7 +64,7 @@ module.exports = {
s3.putObject({
Key: key,
ContentType: 'text/html;charset=UTF-8',
StorageClass: 'REDUCED_REDUNDANCY',
// StorageClass: 'REDUCED_REDUNDANCY',
Body: req.prerender.content
}, function (err, result) {

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"author": "Todd Hooper",
"license": "MIT",
"dependencies": {
"aws-sdk": "~2.307.0"
"aws-sdk": "^2.307.0"
}
}

0 comments on commit 6b7470a

Please sign in to comment.