Skip to content

Commit d127b8e

Browse files
authored
Merge pull request #1142 from dg-i/configurable-s3-endpoint
Make AWS S3 endpoint configurable
2 parents 8c26107 + 9613197 commit d127b8e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/config/environment.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ module.exports = {
4040
s3: {
4141
accessKeyId: process.env.CMD_S3_ACCESS_KEY_ID,
4242
secretAccessKey: process.env.CMD_S3_SECRET_ACCESS_KEY,
43-
region: process.env.CMD_S3_REGION
43+
region: process.env.CMD_S3_REGION,
44+
endpoint: process.env.CMD_S3_ENDPOINT
4445
},
4546
minio: {
4647
accessKey: process.env.CMD_MINIO_ACCESS_KEY,

lib/web/imageRouter/s3.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ exports.uploadImage = function (imagePath, callback) {
4242
}
4343

4444
let s3Endpoint = 's3.amazonaws.com'
45-
if (config.s3.region && config.s3.region !== 'us-east-1') {
45+
if (config.s3.endpoint) {
46+
s3Endpoint = config.s3.endpoint
47+
} else if (config.s3.region && config.s3.region !== 'us-east-1') {
4648
s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
4749
}
4850
callback(null, `https://${s3Endpoint}/${config.s3bucket}/${params.Key}`)

0 commit comments

Comments
 (0)