-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.js
89 lines (78 loc) · 2.2 KB
/
configuration.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function getBaseURL()
{
let baseURL = '';
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test')
{
baseURL = 'http://localhost:3000/';
}
else if (process.env.NODE_ENV === 'production')
{
baseURL = 'https://qrdocent.com/';
}
return baseURL;
}
function getDatabaseCredentials()
{
let credentials;
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test')
{
credentials = {
user: '',
password: '',
host: '',
port: 0,
database: ''
};
credentials.user = process.env.DEV_USER;
credentials.password = process.env.DEV_PASSWORD;
credentials.host = process.env.DEV_HOST;
credentials.port = process.env.DEV_PORT;
credentials.database = process.env.DEV_DATABASE;
}
else if (process.env.NODE_ENV === 'production')
{
credentials = {
user: '',
password: '',
host: '',
port: 0,
database: '',
ssl: {
rejectUnauthorized: false,
ca: ''
}
};
credentials.user = process.env.PROD_USER;
credentials.password = process.env.PROD_PASSWORD;
credentials.host = process.env.PROD_HOST;
credentials.port = process.env.PROD_PORT;
credentials.database = process.env.PROD_DATABASE;
credentials.ssl.ca = process.env.PROD_SSL;
}
return credentials;
}
function getTwilioCredentials()
{
const credentials = {
accountSID: '',
authToken: '',
messagingServiceSID: process.env.TWILIO_MSG_SERVICE_SID
};
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test')
{
credentials.accountSID = process.env.DEV_TWILIO_SID;
credentials.authToken = process.env.DEV_TWILIO_TOKEN;
}
else if (process.env.NODE_ENV === 'production')
{
credentials.accountSID = process.env.PROD_TWILIO_SID;
credentials.authToken = process.env.PROD_TWILIO_TOKEN;
}
return credentials;
}
module.exports =
{
getBaseURL,
getDatabaseCredentials,
getTwilioCredentials
};