mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-27 15:20:57 +00:00
Merge pull request #32 from codimd/aws-endpoints
make aws s3 endpoint configurable
This commit is contained in:
commit
2e627099d8
2 changed files with 5 additions and 2 deletions
|
@ -41,7 +41,8 @@ module.exports = {
|
|||
s3: {
|
||||
accessKeyId: process.env.CMD_S3_ACCESS_KEY_ID,
|
||||
secretAccessKey: process.env.CMD_S3_SECRET_ACCESS_KEY,
|
||||
region: process.env.CMD_S3_REGION
|
||||
region: process.env.CMD_S3_REGION,
|
||||
endpoint: process.env.CMD_S3_ENDPOINT
|
||||
},
|
||||
minio: {
|
||||
accessKey: process.env.CMD_MINIO_ACCESS_KEY,
|
||||
|
|
|
@ -43,7 +43,9 @@ exports.uploadImage = function (imagePath, callback) {
|
|||
}
|
||||
|
||||
let s3Endpoint = 's3.amazonaws.com'
|
||||
if (config.s3.region && config.s3.region !== 'us-east-1') {
|
||||
if (config.s3.endpoint) {
|
||||
s3Endpoint = config.s3.endpoint
|
||||
} else if (config.s3.region && config.s3.region !== 'us-east-1') {
|
||||
s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
|
||||
}
|
||||
callback(null, `https://${s3Endpoint}/${config.s3bucket}/${params.Key}`)
|
||||
|
|
Loading…
Reference in a new issue