-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvironment.js
More file actions
50 lines (43 loc) · 1.47 KB
/
environment.js
File metadata and controls
50 lines (43 loc) · 1.47 KB
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
/*
* Title: Environment Related Files
* Description: Environment Files for Project
* Author: Mohammad Mesbaul Haque
* Github link: https://github.com/mmesba
* Date: 04/03/2022
*/
// Dependencies.
// App object or Module scaffolding.
const environments = {};
// main functions or objects.
// staging environment
environments.staging = {
'port' : 3000,
'envName' : 'staging',
'hashingSecret' : 'This is a secret and should not be exposed',
'templateGlobals' : {
'appName' : 'uptimeChecker',
'companyName' : 'Not real company, inc',
'yearCreated' : '2018',
'baseUrl': 'http://localhost:3000/'
}
}
// Production environment
environments.production = {
'port' : 5000,
'envName' : 'production',
'hashingSecret' : 'This is a secret and should not be exposed',
'templateGlobals' : {
'appName' : 'uptimeChecker',
'companyName' : 'Not real company, inc',
'yearCreated' : '2018',
'baseUrl': 'http://localhost:5000/'
}
}
// Determine which environment was passed as a command line argument
let currentEnvironment = typeof(process.env.NODE_ENV) == 'string' ? process.env.NODE_ENV.toLowerCase() : '';
// Check that the current environment is one of the environments above, if not, default to staging
let environmentToExport = typeof(environments[currentEnvironment]) == 'object' ? environments[currentEnvironment] : environments.staging
// export the module.
module.exports = environmentToExport;