-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.js
37 lines (30 loc) · 954 Bytes
/
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
/*
* Create and export configuration variables
*
*/
// Container for all the environments
const environments = {};
// Staging (default) environment
environments.staging = {
'httpPort': 3000,
'httpsPort': 3001,
'envName': 'staging'
};
// Testing environment
environments.testing = {
'httpPort': 4000,
'httpsPort': 4001,
'envName': 'testing'
};
// Production environment
environments.production = {
'httpPort': 5000,
'httpsPort': 5001,
'envName': 'production'
}
// Determine which envirnoment was passed as a command-line argument
const currentEnvrionment = typeof(process.env.NODE_ENV) === 'string' ? process.env.NODE_ENV.toLowerCase() : '';
// Check the current environment is one of the envirnoments above, if not, default to staging
const environmentToExport = typeof(environments[currentEnvrionment]) === 'object' ? environments[currentEnvrionment] : environments.staging;
// Export the module
module.exports = environmentToExport;