Skip to content

Commit

Permalink
Merge pull request #10673 from saplla/optional-s3-credentials
Browse files Browse the repository at this point in the history
[NEW] Make supplying an AWS access key and secret optional for S3 uploads
  • Loading branch information
engelgabriel committed Jun 4, 2018
2 parents dc21a44 + a6c4bf3 commit e18cc89
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/rocketchat-file-upload/server/config/AmazonS3.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,12 @@ const configure = _.debounce(function() {
// const CDN = RocketChat.settings.get('FileUpload_S3_CDN');
const BucketURL = RocketChat.settings.get('FileUpload_S3_BucketURL');

if (!Bucket || !AWSAccessKeyId || !AWSSecretAccessKey) {
if (!Bucket) {
return;
}

const config = {
connection: {
accessKeyId: AWSAccessKeyId,
secretAccessKey: AWSSecretAccessKey,
signatureVersion: SignatureVersion,
s3ForcePathStyle: ForcePathStyle,
params: {
Expand All @@ -88,6 +86,14 @@ const configure = _.debounce(function() {
URLExpiryTimeSpan
};

if (AWSAccessKeyId) {
config.connection.accessKeyId = AWSAccessKeyId;
}

if (AWSSecretAccessKey) {
config.connection.secretAccessKey = AWSSecretAccessKey;
}

if (BucketURL) {
config.connection.endpoint = BucketURL;
}
Expand Down

0 comments on commit e18cc89

Please sign in to comment.