-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
33 lines (28 loc) · 839 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
/*
* Create and export configuration variables
*
*/
const defaults = {
maxChecks: 5
}
// Container for all the environments
const environments = {
staging: {
envName: 'staging',
httpPort: 3040,
httpsPort: 3041,
hashingSecret: 'thisIsASecret'
},
production: {
envName: 'production',
httpPort: 80,
httpsPort: 443,
hashingSecret: 'thisIsAlsoASecret'
}
}
// Determine which environment was passed as a command-line argument
const currentEnvironment = (process.env.NODE_ENV) ? process.env.NODE_ENV : ''
// Check that the current environment is one of the environments above, if not, default to staging
const specificValues = (environments[currentEnvironment]) ? environments[currentEnvironment] : environments.staging
// Export the module
module.exports = {...defaults, ...specificValues}