diff --git a/lib/config/default.js b/lib/config/default.js index d276e46ef..3c5687f1a 100644 --- a/lib/config/default.js +++ b/lib/config/default.js @@ -74,7 +74,8 @@ module.exports = { accessKeyId: undefined, secretAccessKey: undefined, region: undefined, - endpoint: undefined + endpoint: undefined, + baseURL: undefined }, minio: { accessKey: undefined, diff --git a/lib/config/environment.js b/lib/config/environment.js index 70bdd6c35..53d534171 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -44,7 +44,8 @@ module.exports = { accessKeyId: process.env.CMD_S3_ACCESS_KEY_ID, secretAccessKey: process.env.CMD_S3_SECRET_ACCESS_KEY, region: process.env.CMD_S3_REGION, - endpoint: process.env.CMD_S3_ENDPOINT + endpoint: process.env.CMD_S3_ENDPOINT, + baseURL: process.env.CMD_S3_BASEURL }, minio: { accessKey: process.env.CMD_MINIO_ACCESS_KEY, diff --git a/lib/imageRouter/s3.js b/lib/imageRouter/s3.js index 3f47df209..00b4062fd 100644 --- a/lib/imageRouter/s3.js +++ b/lib/imageRouter/s3.js @@ -57,7 +57,11 @@ exports.uploadImage = function (imagePath, callback) { if (config.s3.endpoint) { s3Endpoint = config.s3.endpoint } - callback(null, `${s3Endpoint}/${config.s3bucket}/${params.Key}`) + if (config.s3.baseURL) { + callback(null, `${config.s3.baseURL}/${params.Key}`) + } else { + callback(null, `${s3Endpoint}/${config.s3bucket}/${params.Key}`) + } }).catch(err => { if (err) { callback(new Error(err), null)