Skip to content
Snippets Groups Projects
Commit f752cc80 authored by Diego Sampaio's avatar Diego Sampaio
Browse files

support for region and bucketUrl S3 configs

parent 24774349
No related branches found
No related tags found
No related merge requests found
......@@ -208,7 +208,9 @@
"FileUpload_S3_AWSAccessKeyId" : "Amazon S3 AWSAccessKeyId",
"FileUpload_S3_AWSSecretAccessKey" : "Amazon S3 AWSSecretAccessKey",
"FileUpload_S3_Bucket" : "Amazon S3 bucket name",
"FileUpload_S3_CDN" : "CDN domain",
"FileUpload_S3_BucketURL" : "Bucket URL",
"FileUpload_S3_CDN" : "CDN domain for downloads",
"FileUpload_S3_Region" : "Region",
"FileUpload_Storage_Type" : "Storage Type",
"Follow_social_profiles" : "Follow our social profiles, fork us on github and share your thoughts about the rocket.chat app on our trello board.",
"Force_SSL" : "Force SSL",
......@@ -442,6 +444,7 @@
"OS_Type" : "OS Type",
"OS_Uptime" : "OS Uptime",
"others" : "others",
"Override_URL_to_which_files_are_uploaded_This_url_also_used_for_downloads_unless_a_CDN_is_given" : "Override URL to which files are uploaded. This url also used for downloads unless a CDN is given",
"Password" : "Password",
"Password_Change_Disabled" : "Your Rocket.Chat administrator has disabled the changing of passwords",
"Password_changed_successfully" : "Password changed successfully",
......
......@@ -7,6 +7,8 @@ createS3Directive = _.debounce(() => {
var accessKey = RocketChat.settings.get('FileUpload_S3_AWSAccessKeyId');
var secretKey = RocketChat.settings.get('FileUpload_S3_AWSSecretAccessKey');
var cdn = RocketChat.settings.get('FileUpload_S3_CDN');
var region = RocketChat.settings.get('FileUpload_S3_Region');
var bucketUrl = RocketChat.settings.get('FileUpload_S3_BucketURL');
if (type === 'AmazonS3' && !_.isEmpty(bucket) && !_.isEmpty(accessKey) && !_.isEmpty(secretKey)) {
if (Slingshot._directives[directiveName]) {
......@@ -31,6 +33,14 @@ createS3Directive = _.debounce(() => {
config.cdn = cdn;
}
if (!_.isEmpty(region)) {
config.region = region;
}
if (!_.isEmpty(bucketUrl)) {
config.bucketUrl = bucketUrl;
}
Slingshot.createDirective(directiveName, Slingshot.S3Storage, config);
} else {
if (Slingshot._directives[directiveName]) {
......@@ -62,3 +72,11 @@ RocketChat.settings.get('FileUpload_S3_AWSSecretAccessKey', function(settingKey,
RocketChat.settings.get('FileUpload_S3_CDN', function(settingKey, settingValue) {
createS3Directive();
});
RocketChat.settings.get('FileUpload_S3_Region', function(settingKey, settingValue) {
createS3Directive();
});
RocketChat.settings.get('FileUpload_S3_BucketURL', function(settingKey, settingValue) {
createS3Directive();
});
......@@ -69,5 +69,20 @@ RocketChat.settings.addGroup('FileUpload', function() {
value: 'AmazonS3'
}
});
this.add('FileUpload_S3_Region', '', {
type: 'string',
enableQuery: {
_id: 'FileUpload_Storage_Type',
value: 'AmazonS3'
}
});
this.add('FileUpload_S3_BucketURL', '', {
type: 'string',
enableQuery: {
_id: 'FileUpload_Storage_Type',
value: 'AmazonS3'
},
i18nDescription: 'Override_URL_to_which_files_are_uploaded_This_url_also_used_for_downloads_unless_a_CDN_is_given.'
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment