forked from mape/node-express-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 31
/
siteConfig.js
88 lines (76 loc) · 2.78 KB
/
siteConfig.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var cf = require('cloudfoundry');
var settings = {
'user_email' : 'mwilkinson@vmware.com',
'user' : {
'name' : 'Monica Wilkinson',
'website' : 'http://ciberch.cloudfoundry.com'
},
'sessionSecret': 'sessionSecret'
, 'internal_host' : '127.0.0.1'
, 'internal_port' : 8080
, 'port': 8080
, 'uri': 'http://moni-air.local:8080' // Without trailing /
, 'redisOptions': {host: '127.0.0.1', port: 6379}
, 'mongoUrl': 'mongodb://localhost/mongodb-asms'
// You can add multiple recipients for notifo notifications
, 'notifoAuth': null /*[
{
'username': ''
, 'secret': ''
}
]*/
// Enter API keys to enable auth services, remove entire object if they aren't used.
, 'external': {
'facebook': {
appId: process.env.facebook_app_id,
appSecret: process.env.facebook_app_secret
}
, 'twitter': {
consumerKey: process.env.twitter_consumer_key,
consumerSecret: process.env.twitter_consumer_secret
}
, 'github': {
appId: process.env.github_client_id,
appSecret: process.env.github_client_secret
}
}
, 'debug': cf.cloud
};
console.log("ENV for new CF is");
console.dir(process.env);
if (cf.cloud) {
settings.uri = 'http://' + cf.app.name + '.cfapps.io';
settings.internal_host = cf.host;
settings.internal_port = cf.port;
settings.port = 80; // CloudFoundry uses process.env.VMC_APP_PORT
settings.airbrakeApiKey = process.env.airbrake_api_key; // Error logging, Get free API key from https://airbrakeapp.com/account/new/Free
var redisCloud = 'rediscloud-n/a', redisConfig;
if (cf.redis['redis-asms'] != null) {
redisConfig = cf.redis['redis-asms'].credentials;
} else if (cf.services[redisCloud] && cf.services[redisCloud].length == 1) {
console.log("Using Redis Cloud");
svc = cf.services[redisCloud][0];
redisConfig = svc['credentials'];
}
if (redisConfig) {
settings.redisOptions.port = redisConfig.port;
settings.redisOptions.host = redisConfig.hostname;
settings.redisOptions.pass = redisConfig.password;
console.log("Redis options are");
console.dir(settings.redisOptions);
}
var mongolab = 'mongolab-n/a'; // Cloud Foundry v2.0
if (cf.mongodb['mongo-asms']) {
var cfg = cf.mongodb['mongo-asms'].credentials;
settings.mongoUrl = ["mongodb://", cfg.username, ":", cfg.password, "@", cfg.hostname, ":", cfg.port,"/" + cfg.db].join('');
} else if (cf.services[mongolab] && cf.services[mongolab].length == 1) {
console.log("Using MongoLab");
var svc = cf.services[mongolab][0];
settings.mongoUrl = svc['credentials']['uri'];
} else {
console.log("Could not find a MongoDB :(")
console.dir(cf.services);
}
settings.user_email = cf.app['users'][0];
}
module.exports = settings;