-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebApplicationProcessor.js
More file actions
61 lines (57 loc) · 1.28 KB
/
Copy pathWebApplicationProcessor.js
File metadata and controls
61 lines (57 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var fs=require('fs')
var contextMap=new Map();
var confData={};
var contextNames=fs.readdirSync('./apps');
function WebApplication(vhomepage="",vmapping={})
{
var homepage=vhomepage;
var mapping=vmapping;
this.setHomepage=function(xHomepage){
homepage=xHomepage;
};
this.getHomepage=function()
{
return homepage;
}
this.setMapping=function(xMapping)
{
mapping=xMapping;
};
this.getMapping=function()
{
return mapping;
};
}
function loadConfiguration()
{
try
{
var serverData=JSON.parse(fs.readFileSync('./server.conf'));
}catch(err)
{
console.log("server.conf not found.");
}
return serverData;
}
function loadDataStructure()
{
contextNames.forEach(function(contextName){
webApplication=new WebApplication();
try
{
var confFilePath='./apps/'+contextName+'/private/app.conf';
//console.log("Conf file path "+confFilePath);
confData=JSON.parse(fs.readFileSync(confFilePath));
webApplication.setHomepage(confData["homepage"]);
webApplication.setMapping(confData["mapping"]);
contextMap.set(contextName,webApplication);
}catch(err)
{
contextMap.set(contextName,webApplication);
console.log("app.conf not found.");
}
});
return contextMap;
}
module.exports.loadConfiguration=loadConfiguration;
module.exports.loadDataStructure=loadDataStructure;