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