|
@@ -10,6 +10,7 @@ module.exports = function(crowi) {
|
|
|
, config = crowi.getConfig()
|
|
, config = crowi.getConfig()
|
|
|
, lib = {}
|
|
, lib = {}
|
|
|
, getAwsConfig = function() {
|
|
, getAwsConfig = function() {
|
|
|
|
|
+ var config = crowi.getConfig();
|
|
|
return {
|
|
return {
|
|
|
accessKeyId: config.crowi['aws:accessKeyId'],
|
|
accessKeyId: config.crowi['aws:accessKeyId'],
|
|
|
secretAccessKey: config.crowi['aws:secretAccessKey'],
|
|
secretAccessKey: config.crowi['aws:secretAccessKey'],
|
|
@@ -26,7 +27,7 @@ module.exports = function(crowi) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
lib.uploadFile = function(filePath, contentType, fileStream, options) {
|
|
lib.uploadFile = function(filePath, contentType, fileStream, options) {
|
|
|
- var awsConfig = lib.getAwsConfig();
|
|
|
|
|
|
|
+ var awsConfig = getAwsConfig();
|
|
|
if (!Config.isUploadable(config)) {
|
|
if (!Config.isUploadable(config)) {
|
|
|
return new Promise.reject(new Error('AWS is not configured.'));
|
|
return new Promise.reject(new Error('AWS is not configured.'));
|
|
|
}
|
|
}
|
|
@@ -56,7 +57,7 @@ module.exports = function(crowi) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
lib.generateUrl = function(filePath) {
|
|
lib.generateUrl = function(filePath) {
|
|
|
- var awsConfig = lib.getAwsConfig()
|
|
|
|
|
|
|
+ var awsConfig = getAwsConfig()
|
|
|
, url = 'https://' + awsConfig.bucket +'.s3.amazonaws.com/' + filePath;
|
|
, url = 'https://' + awsConfig.bucket +'.s3.amazonaws.com/' + filePath;
|
|
|
|
|
|
|
|
return url;
|
|
return url;
|