-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.node.js
65 lines (52 loc) · 2.32 KB
/
server.node.js
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
62
63
64
console.log("loading it up !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
var HttpMaster = require("http-master");
var httpMaster = new HttpMaster();
var env = "ec2";
var config = require("./config.ec2.json");
//var config = require("./config.json");
// testing url: http://boomhifive-proxy.elasticbeanstalk.com/image_proxy/?action=imgproxy&imgname=http://hyperallergic.com/wp-content/uploads/2015/07/jesusmarymet02.jpg&width=200
// http://boomhifive-proxy.elasticbeanstalk.com/http://hyperallergic.com/wp-content/uploads/2015/07/jesusmarymet02.jpg&width=200
// "*/image_proxy/*" : ["addHeader -> host=fast-mesa-5492.herokuapp.com", "addHeader -> port=80","http://fast-mesa-5492.herokuapp.com/?action=imgproxy&imgname=[2]"],
// "*/image_proxy/*" : ["addHeader -> host=fast-mesa-5492.herokuapp.com", "addHeader -> port=80","http://fast-mesa-5492.herokuapp.com/?action=imgproxy&imgname=[2]"],
httpMaster.init(config,
function(err){
// listening
console.log("proxy running");
if(err){
console.log("some sort of proxy error......!! !!....................");
console.log(err);
}
if(env == "local"){
try {
console.log('Old User ID: ' + process.getuid() + ', Old Group ID: ' + process.getgid());
process.setgid('staff');
process.setuid('donundeen');
console.log('New User ID: ' + process.getuid() + ', New Group ID: ' + process.getgid());
} catch (err) {
console.log('Cowardly refusing to keep the process alive as root.');
console.log(err);
process.exit(1);
}
}else if (env=="metmuseum"){
try {
console.log('Old User ID: ' + process.getuid() + ', Old Group ID: ' + process.getgid());
process.setgid('metmuseum');
process.setuid('metmuseum');
console.log('New User ID: ' + process.getuid() + ', New Group ID: ' + process.getgid());
} catch (err) {
console.log('Cowardly refusing to keep the process alive as root.');
process.exit(1);
}
}else {
}
});
httpMaster.logNotice(function(msg){
console.log("logging notice nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
console.log(msg);
});
httpMaster.logError(function(msg){
if(msg){
console.log("logging error @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
console.log(msg);
}
});