[beta18 | DONE | CHANGED] uploadService.js: Added the ability to read port either from environment variables or from properties file.

This commit is contained in:
Konstantina Galouni 2025-01-10 17:29:04 +02:00
parent d3d21fa834
commit c11eaa8d02
1 changed files with 3 additions and 2 deletions

View File

@ -13,6 +13,7 @@ if (properties.get('ssl')) {
} else {
http = require("http");
}
const port = process.env['PORT'] || properties.get('port');
var searchServiceAPIUrl = properties.get('searchServiceAPIUrl');
var monitorServiceAPIUrl = properties.get('monitorAPIUrl');
var irishMonitorServiceAPIUrl = properties.get('irishMonitorAPIUrl');
@ -107,7 +108,7 @@ app.get('/explore/home', async function (req, res) {
let openOrgsId = properties.get('environment') != "production" ? 'openaire____%3A%3A0362fcdb3076765d9c0041ad331553e8' : "";
// Make requests to multiple APIs
let requests= [
"http://localhost:" + properties.get('port') + "/portals/countResults",
"http://localhost:" + port + "/portals/countResults",
searchServiceAPIUrl +'results/?fields=relfunder&sf=relfunder&format=json&size=0',
searchServiceAPIUrl + 'datasources/count?format=json',
searchServiceAPIUrl + 'resources2/?format=json&size=0&type=organizations&fq=(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=* or reldatasourcecompatibilityid = native'+(openOrgsId ? (' or collectedfromdatasourceid="'+openOrgsId+'"') : "")+')',
@ -400,7 +401,7 @@ function parseNoOfFunders(resultRES, projectsRES){
}
const server = app.listen(properties.get('port'), function () {
const server = app.listen(port, function () {
console.log("Listening on port %s...", server.address().port);
});