-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
98 lines (80 loc) · 3.49 KB
/
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
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
89
90
91
92
93
94
95
96
97
98
var fs = require('fs'),
path = require('path');
var config = exports;
config.http = {
host: process.env.MUCHMALA_FE_HTTP_HOST || '0.0.0.0',
port: process.env.MUCHMALA_FE_HTTP_PORT || 8000
};
config.http.url = process.env.MUCHMALA_FE_URL || 'http://muchmala.dev';
config.io = {};
config.io.url = process.env.MUCHMALA_IO_URL || 'http://io.muchmala.dev';
config.static = {
host: process.env.MUCHMALA_FE_STATIC_HOST || "static.muchmala.dev",
port: process.env.MUCHMALA_FE_STATIC_PORT || 8080,
// see getStaticVersion() below
//version: process.env.MUCHMALA_FE_STATIC_VERSION || 1,
versionFile: process.env.MUCHMALA_FE_STATIC_VERSION_FILE || './staticversion.json',
minified: process.env.MUCHMALA_FE_STATIC_MINIFIED || false
};
config.static.url = "http://" + config.static.host + ((config.static.port != 80) ? ":" + config.static.port : "");
config.storage = {
type: process.env.MUCHMALA_STORAGE_TYPE || 'file',
file: {
location: process.env.MUCHMALA_STORAGE_FILE_LOCATION || '/opt/muchmala/webroot'
},
s3: {
key: process.env.MUCHMALA_STORAGE_S3_KEY || null,
secret: process.env.MUCHMALA_STORAGE_S3_SECRET || null,
bucket: process.env.MUCHMALA_STORAGE_S3_BUCKET || 'dev.muchmala.com'
}
};
config.mongodb = {
host: process.env.MUCHMALA_MONGODB_HOST || '127.0.0.1',
user: process.env.MUCHMALA_MONGODB_USER || 'mongodb',
database: process.env.MUCHMALA_MONGODB_DATABASE || 'muchmala'
};
config.queue = {
host: process.env.MUCHMALA_QUEUE_HOST || "127.0.0.1",
port: process.env.MUCHMALA_QUEUE_PORT || 6379,
password: process.env.MUCHMALA_QUEUE_PASSWORD || undefined,
database: process.env.MUCHMALA_QUEUE_DATABASE || 0
};
config.cache = config.queue;
config.autenticationServices = {
active: process.env.MUCHMALA_AUTH_SERVICES && process.env.MUCHMALA_AUTH_SERVICES.split(',') || '',
Twitter: {
consumerKey: process.env.MUCHMALA_AUTH_TWITTER_KEY || null,
consumerSecret: process.env.MUCHMALA_AUTH_TWITTER_SECRET || null
},
Facebook: {
appId: process.env.MUCHMALA_AUTH_FACEBOOK_APPID || null,
appSecret: process.env.MUCHMALA_AUTH_FACEBOOK_SECRET || null,
callback: process.env.MUCHMALA_AUTH_FACEBOOK_CALLBACK || config.http.url + '/auth/facebook',
scope: process.env.MUCHMALA_AUTH_FACEBOOK_SCOPE || 'email'
},
Google: {
consumerKey: process.env.MUCHMALA_AUTH_GOOGLE_KEY || null,
consumerSecret: process.env.MUCHMALA_AUTH_GOOGLE_SECRET || null,
callback: process.env.MUCHMALA_AUTH_GOOGLE_CALLBACK || config.http.url + '/auth/google',
scope: process.env.MUCHMALA_AUTH_GOOGLE_SCOPE || ''
},
Yahoo: {
consumerKey: process.env.MUCHMALA_AUTH_YAHOO_KEY || null,
consumerSecret: process.env.MUCHMALA_AUTH_YAHOO_SECRET || null,
callback: process.env.MUCHMALA_AUTH_YAHOO_SCOPE || config.http.url + '/auth/yahoo'
}
};
config.googleAnalyticsKey = process.env.MUCHMALA_GOOGLE_ANALYTICS_KEY || null;
config.getStaticVersion = function() {
if (process.env.MUCHMALA_FE_STATIC_VERSION) {
return process.env.MUCHMALA_FE_STATIC_VERSION;
}
if (path.existsSync(config.static.versionFile)) {
var staticVersion = JSON.parse(fs.readFileSync(config.static.versionFile));
return staticVersion;
}
return 1;
};
config.setStaticVersion = function(staticVersion) {
fs.writeFileSync(config.static.versionFile, JSON.stringify(staticVersion));
};