-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
72 lines (70 loc) · 1.5 KB
/
config.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
65
66
67
68
69
70
71
72
module.exports = {
tailabeCollection:"system.profile",
database: {
dev: {
protocol: "mongodb",
host: "localhost",
port: "27017",
database: "notificationSystem",
username: "",
password: ""
},
production: {
protocol: "mongodb",
host: "localhost",
port: "27017",
database: "notificationSystem",
username: "",
password: ""
}
},
tokenSettings: {
dev: {
accessToken: {
time: "2",
unit: "hours",
secret: "testSecretForTest"
}
},
production: {
accessToken: {
time: "2",
unit: "hours",
secret: "testSecretForProduction"
}
}
},
timeUnits:{
"seconds": 's',
"minutes": 'm',
"hours": "h",
"days": "d"
},
getConnectionString: function(env) {
var connection;
var connectionString = "";
if (env == 'dev')
connection = this.database.dev;
else if (env == 'production')
connection = this.database.production;
else
connection = null;
if (connection) {
connectionString = connection.protocol + "://";
if (connection.username!="" && connection.password!="")
connectionString += connection.username + ":" + connection.password + "@";
connectionString += connection.host + ":" + connection.port +"/"+ connection.database;
return connectionString
} else
return null;
},
getTokenSettings:function(env){
if(env=='dev')
return this.tokenSettings.dev.accessToken;
else if(env=='production')
return this.tokenSettings.production.accessToken;
},
getTimeUnits:function(){
return this.timeUnits;
}
}