-
Notifications
You must be signed in to change notification settings - Fork 9
/
app.js
49 lines (36 loc) · 1.09 KB
/
app.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
var server = require("./servercore");
//
// Nodepot main start file
//
//
// Priorities for configfile
//
// 1. CommandLine
// 2. OpenShift location
// 3. Hardcoded location
//
var myArgs = process.argv;
var configNew = myArgs[2];
// get data directory for OpenShift (easy check, if we run in Openshift)
var openShiftDataDir = process.env.OPENSHIFT_DATA_DIR;
if (configNew != undefined) {
console.log("Found optional path to config file " + configNew);
}
else if (openShiftDataDir != undefined)
{
configNew = openShiftDataDir + "/config";
}
else
{
configNew = '/etc/nodepot/config';
}
var config = require(configNew);
if (openShiftDataDir != undefined)
{
config.port = process.env.OPENSHIFT_NODEJS_PORT;
console.log("Nodepot (app.js): Starting DB client with ip/port server " + process.env.OPENSHIFT_REDIS_PORT + " : " + process.env.OPENSHIFT_REDIS_HOST);
}
console.log("Starting nodepot with config from file " + configNew);
console.log("Starting Nodepot in " + config.mode + " mode ");
console.log("Starting Nodepot listening on local port " + config.port);
server.start(configNew);