-
Notifications
You must be signed in to change notification settings - Fork 9
/
dbcore.js
39 lines (31 loc) · 978 Bytes
/
dbcore.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
var redis = require("redis");
var port = process.env.OPENSHIFT_REDIS_PORT;
function initClient()
{
var openShiftIP = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
if (openShiftIP != undefined)
{
console.log("Starting DB client with ip/port server " + port + " : " + process.env.OPENSHIFT_REDIS_HOST + " on openshift");
var client = redis.createClient(port, process.env.OPENSHIFT_REDIS_HOST);
client.auth(process.env.REDIS_PASSWORD);
return client;
}
else
{
console.log("Starting DB without special parameters outside of OpenShift environment ...");
var client = redis.createClient();
return client;
}
}
var client = initClient();
console.log("Starting after initclient...");
if (client != undefined)
{
console.log("client after initClient is defined");
}
else
{
console.log("client after initClient is not defined");
}
module.exports = client;
exports.initClient = initClient;