Skip to content

Commit

Permalink
Merge pull request #1683 from hackmdio/bugfix/fix-image-upload-s3-config
Browse files Browse the repository at this point in the history
Fix S3 client config passing for image upload
  • Loading branch information
a60814billy committed May 19, 2021
2 parents 54f6e55 + a41c4db commit 599fd41
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/imageRouter/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ const logger = require('../logger')
const { S3Client } = require('@aws-sdk/client-s3-node/S3Client')
const { PutObjectCommand } = require('@aws-sdk/client-s3-node/commands/PutObjectCommand')

const s3 = new S3Client(config.s3)
const credentials = {
accessKeyId: config.s3.accessKeyId,
secretAccessKey: config.s3.secretAccessKey
}

const s3 = new S3Client({
credentials,
region: config.s3.region,
endpoint: config.s3.endpoint
})

exports.uploadImage = function (imagePath, callback) {
if (!imagePath || typeof imagePath !== 'string') {
Expand Down

0 comments on commit 599fd41

Please sign in to comment.