UploadService:
add properties file make it work for beta add new property local path git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@56159 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
b70716fb5f
commit
44dc17c6c1
|
@ -0,0 +1,5 @@
|
|||
userInfoUrl = https://beta.services.openaire.eu/uoa-user-management/api/users/getUserInfo?accessToken=
|
||||
originServer = .openaire.eu
|
||||
post.allowed = /upload,/upload/
|
||||
ssl = true
|
||||
localPath = false
|
|
@ -0,0 +1,4 @@
|
|||
#mv beta-properties.file properties.file
|
||||
|
||||
#rm -rf node_modules/ run.sh uploads/
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
userInfoUrl = http://scoobydoo.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=
|
||||
originServer = .di.uoa.gr
|
||||
post.allowed = /upload
|
||||
post.allowed = /upload,/upload/
|
||||
ssl = false
|
||||
localPath = true
|
||||
|
|
|
@ -19,6 +19,7 @@ if(properties.get('ssl')) {
|
|||
var auth = properties.get('userInfoUrl');
|
||||
var originServer = properties.get('originServer');
|
||||
var allowPostRequests = properties.get('post.allowed').split(',');
|
||||
var localPath = properties.get('localPath');
|
||||
|
||||
var storage = multer.diskStorage({
|
||||
destination: function (req, file, cb) {
|
||||
|
@ -67,7 +68,7 @@ app.use(function (req, res, next) {
|
|||
});
|
||||
|
||||
app.post("/upload", upload.array("uploads[]", 12), function (req, res) {
|
||||
var filepath = "./" + req.files[0].path;
|
||||
var filepath = (localPath?".":__dirname)+"/" + req.files[0].path;
|
||||
if (req.files[0].mimetype !== 'text/csv') {
|
||||
console.error("No proper file type");
|
||||
res.status(500).send(getResponse(500, "No proper file type"));
|
||||
|
@ -233,4 +234,3 @@ function hasValidOrigin(origin) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue