-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
30 lines (24 loc) · 845 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
/*
* Create and export configuration variables
*
*/
// Container for all environments
var 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
var 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
var environmentToExport = typeof(environments[currentEnvironment]) == 'object' ? environments[currentEnvironment] : environments.staging;
// Export the module
module.exports = environmentToExport;