Choose your endpoint.

See https://github.com/mozilla/send/issues/1239
This commit is contained in:
Mathieu Lecarme 2019-11-08 17:44:04 +01:00
parent deec85be14
commit 2d22573588
1 changed files with 8 additions and 0 deletions

View File

@ -1,4 +1,12 @@
const AWS = require('aws-sdk');
const config = {};
if (typeof process.env.AWS_S3_ENDPOINT !== 'undefined') {
config['endpoint'] = process.env.AWS_S3_ENDPOINT;
}
if (typeof process.env.AWS_S3_USE_PATH_STYLE_ENDPOINT !== 'undefined') {
config['s3ForcePathStyle'] = process.env.AWS_S3_USE_PATH_STYLE_ENDPOINT == 'true' ? true : false;
}
AWS.config.update(config);
const s3 = new AWS.S3();
class S3Storage {