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

add CDN config option

parent c82df573
No related branches found
No related tags found
No related merge requests found
......@@ -197,6 +197,7 @@
"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_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",
......
......@@ -6,6 +6,7 @@ createS3Directive = _.debounce(() => {
var acl = RocketChat.settings.get('FileUpload_S3_Acl');
var accessKey = RocketChat.settings.get('FileUpload_S3_AWSAccessKeyId');
var secretKey = RocketChat.settings.get('FileUpload_S3_AWSSecretAccessKey');
var cdn = RocketChat.settings.get('FileUpload_S3_CDN');
if (type === 'AmazonS3' && !_.isEmpty(bucket) && !_.isEmpty(accessKey) && !_.isEmpty(secretKey)) {
if (Slingshot._directives[directiveName]) {
......@@ -26,6 +27,10 @@ createS3Directive = _.debounce(() => {
config.acl = acl;
}
if (!_.isEmpty(cdn)) {
config.cdn = cdn;
}
Slingshot.createDirective(directiveName, Slingshot.S3Storage, config);
} else {
if (Slingshot._directives[directiveName]) {
......@@ -53,3 +58,7 @@ RocketChat.settings.get('FileUpload_S3_AWSAccessKeyId', function(settingKey, set
RocketChat.settings.get('FileUpload_S3_AWSSecretAccessKey', function(settingKey, settingValue) {
createS3Directive();
});
RocketChat.settings.get('FileUpload_S3_CDN', function(settingKey, settingValue) {
createS3Directive();
});
......@@ -48,5 +48,14 @@ Meteor.startup(function() {
value: 'AmazonS3'
}
});
RocketChat.settings.add('FileUpload_S3_CDN', '', {
group: 'FileUpload',
section: 'Amazon S3',
type: 'string',
enableQuery: {
_id: 'FileUpload_Storage_Type',
value: 'AmazonS3'
}
});
});
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