Browse Source

Fix: failed to call getAwdConfig()

Sotaro KARASAWA 10 years ago
parent
commit
0f3ebff1da
1 changed files with 3 additions and 2 deletions
  1. 3 2
      local_modules/crowi-fileupload-aws/index.js

+ 3 - 2
local_modules/crowi-fileupload-aws/index.js

@@ -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;