Verify if dataSources.json exist

This commit is contained in:
Miguel González Aravena 2017-08-15 03:46:40 -03:00
parent 9597144422
commit 9ebfdcbdc2
1 changed files with 23 additions and 3 deletions

View File

@ -11,11 +11,31 @@ var IncomingForm = require('formidable');
var StringDecoder = require('string_decoder').StringDecoder;
var path = require('path');
var uuid = require('uuid');
var defaultOptions = {
maxFileSize: 10 * 1024 * 1024, // 10 MB
var fs = require('fs');
var defaultOptions = function() {
var dataSources = path.join(__dirname, '../../../server/datasources.json');
fs.stat(dataSources, function(err, stats) {
if(!error) {
return require(dataSources).container;
} else {
return false;
}
});
};
var isImage = function(ext) {
switch(ext) {
case '.jpg':
case '.jpeg':
case '.png':
return true;
break;
default:
return false;
break;
}
}
/**
* Handle multipart/form-data upload to the storage service
* @param {Object} provider The storage service provider