From 2d22573588538cf227565b6b0a139bf40db5f891 Mon Sep 17 00:00:00 2001 From: Mathieu Lecarme Date: Fri, 8 Nov 2019 17:44:04 +0100 Subject: [PATCH] Choose your endpoint. See https://github.com/mozilla/send/issues/1239 --- server/storage/s3.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/storage/s3.js b/server/storage/s3.js index bb2b0100..271fa605 100644 --- a/server/storage/s3.js +++ b/server/storage/s3.js @@ -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 {