-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfig.js
117 lines (113 loc) · 3.41 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* jshint node: true */
'use strict';
var parseAdmins = function(adminsStr) {
var admins;
if (adminsStr) {
admins = adminsStr.split(',');
}
return admins;
};
var parseBool = function(value) {
if (!value) { return false; }
if (typeof value === 'string') {
if (value.toLowerCase() === 'true') { return true; }
else if (value.toLowerCase() === '1') { return true; }
else { return false; }
}
else if (typeof value === 'number') {
if (Number(value) > 0) { return true; }
else { return false; }
}
else { return Boolean(value); }
};
var parseNumber = function(envVar, defaultVar) {
if (!isNaN(parseFloat(envVar)) && isFinite(envVar)) {
return Number(envVar);
}
else { return defaultVar; }
};
module.exports = {
port: Number(process.env.PORT) || 8080,
trustProxy: process.env.TRUST_PROXY || false,
admins: parseAdmins(process.env.ADMINS) || ['012345'],
sbPrefix: '/sb',
senderEmail: process.env.SENDER_EMAIL || '[email protected]',
antiSnipeMinutes: parseNumber(process.env.ANTISNIPE_MINUTES, 30),
redis: {
host: process.env.REDIS_HOST || '127.0.0.1',
port: Number(process.env.REDIS_PORT) || 6379
},
sessionSecret: process.env.SESSION_SECRET || 'secret string for adness 1234!',
mysql: {
host: process.env.MYSQL_HOST || 'localhost',
port: Number(process.env.MYSQL_PORT) || 3306,
username: process.env.MYSQL_USERNAME || 'root',
password: process.env.MYSQL_PASSWORD || 'password',
database: process.env.MYSQL_DATABASE || 'smf'
},
couchdb: {
proto: process.env.DB_PROTO || 'http',
host: process.env.DB_HOST || 'localhost:5984',
name: process.env.DB_NAME || 'adness',
user: process.env.DB_USER || null,
pass: process.env.DB_PASS || null
},
baron: {
url: process.env.BARON_URL || 'http://baron.example.com',
internalUrl: process.env.BARON_INTERNAL_URL || 'http://localhost:5000',
key: process.env.BARON_API_KEY || ''
},
admin: {
emails: process.env.ADMIN_EMAILS || ['[email protected]'],
},
site: {
url: process.env.SITE_URL || 'http://example.com',
internalUrl: process.env.SITE_INTERNAL_URL || 'http://localhost:3000'
},
bitcoin: {
numberOfConfs: parseNumber(process.env.CONFS, 2)
},
regions: [
{
name: 'US',
countries: ['US'],
exclusive: false
},
{
name: 'CN',
countries: ['CN'],
exclusive: false
},
{
name: 'RU',
countries: ['RU'],
exclusive: false
},
{
name: 'Global'
},
{
name: 'Global Non-US',
countries: ['US'],
exclusive: true
}
],
rounds: {
maxRounds: 6,
round1: { timeOffset: 1000 * 60 * 60 * 24, discount: 0 },
round2: { timeOffset: 1000 * 60 * 60 * 12, discount: 0.075 },
round3: { timeOffset: 1000 * 60 * 60 * 6, discount: 0.15 },
round4: { timeOffset: 1000 * 60 * 60 * 3, discount: 0.30 },
round5: { timeOffset: 1000 * 60 * 60 * 1.5, discount: 0.60},
round6: { timeOffset: 1000 * 60 * 60 * 1.5, discount: 0.80 }
},
fakeAuth: {
enabled: parseBool(process.env.FAKEAUTH) || false,
userId: parseNumber(process.env.FAKEAUTH_USERID, 1),
email: process.env.FAKEAUTH_EMAIL || '[email protected]',
admin: parseBool(process.env.FAKEAUTH_ADMIN) || false
},
debugMode: parseBool(process.env.DEBUG_MODE) || false,
registrationFee: parseNumber(process.env.REGISTRATION_FEE, 0.01),
enableAPI: parseBool(process.env.ENABLE_API) || false
};