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:
argiro.kokogiannaki 2019-06-21 11:11:50 +00:00
parent b70716fb5f
commit 44dc17c6c1
4 changed files with 13 additions and 3 deletions

View File

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

View File

@ -0,0 +1,4 @@
#mv beta-properties.file properties.file
#rm -rf node_modules/ run.sh uploads/

View File

@ -1,4 +1,5 @@
userInfoUrl = http://scoobydoo.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken= userInfoUrl = http://scoobydoo.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=
originServer = .di.uoa.gr originServer = .di.uoa.gr
post.allowed = /upload post.allowed = /upload,/upload/
ssl = false ssl = false
localPath = true

View File

@ -19,6 +19,7 @@ if(properties.get('ssl')) {
var auth = properties.get('userInfoUrl'); var auth = properties.get('userInfoUrl');
var originServer = properties.get('originServer'); var originServer = properties.get('originServer');
var allowPostRequests = properties.get('post.allowed').split(','); var allowPostRequests = properties.get('post.allowed').split(',');
var localPath = properties.get('localPath');
var storage = multer.diskStorage({ var storage = multer.diskStorage({
destination: function (req, file, cb) { 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) { 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') { if (req.files[0].mimetype !== 'text/csv') {
console.error("No proper file type"); console.error("No proper file type");
res.status(500).send(getResponse(500, "No proper file type")); res.status(500).send(getResponse(500, "No proper file type"));
@ -233,4 +234,3 @@ function hasValidOrigin(origin) {
return false; return false;
} }
} }