-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.js
36 lines (23 loc) · 801 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
/**
Configuration file.
Follows the twelve-factor app guidelines:
http://www.12factor.net/config
Define config variables by setting environment variables, which by
default are prefixed with GND, such as GND_APP_PORT.
Some default values are provided for convenience.
*/
var env = process.env
, prefix = 'GND';
var config = {
APP_PORT: _('APP_PORT', 8080),
REDIS_PORT: _('REDIS_PORT', 6379),
REDIS_ADDR: _('REDIS_ADDR', 'localhost'),
MONGODB_URI: _('MONGODB_URI', 'mongodb://localhost/nodepress'),
COOKIE: _('COOKIE', 'gnd-cookie'),
MODE: _('MODE', 'development')
}
config.DEVELOPMENT = _('DEVELOPMENT', config.MODE === 'development');
function _(variable, defaultValue){
return env[prefix+'_'+variable] || defaultValue;
}
module.exports = config;