Skip to content

Commit 667a5fb

Browse files
author
Ivan Kalinin
committed
Support for custom endpoint
1 parent 78739ae commit 667a5fb

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
var s3 = new (require('aws-sdk')).S3({ params: { Bucket: process.env.S3_BUCKET_NAME } });
1+
var AWS = require('aws-sdk')
2+
AWS.config.logger = console;
3+
4+
var s3_options = { params: { Bucket: process.env.S3_BUCKET_NAME } }
5+
6+
// if (process.env.S3_REGION)
7+
// s3_options.region = process.env.S3_REGION
8+
if (process.env.S3_ENDPOINT)
9+
s3_options.endpoint = new AWS.Endpoint(process.env.S3_ENDPOINT)
10+
11+
var s3 = new AWS.S3(s3_options);
212

313
module.exports = {
414

@@ -55,7 +65,7 @@ module.exports = {
5565
s3.putObject({
5666
Key: key,
5767
ContentType: 'text/html;charset=UTF-8',
58-
StorageClass: 'REDUCED_REDUNDANCY',
68+
// StorageClass: 'REDUCED_REDUNDANCY',
5969
Body: req.prerender.content
6070
}, function (err, result) {
6171

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"author": "Todd Hooper",
77
"license": "MIT",
88
"dependencies": {
9-
"aws-sdk": "~2.307.0"
9+
"aws-sdk": "^2.307.0"
1010
}
1111
}

0 commit comments

Comments
 (0)