forked from ufosc/Club_Website_2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
46 lines (43 loc) · 1.32 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
const NODE_ENV = process.env.NODE_ENV || 'development'
// Rate limiter
const limiterTemplate = {
windowMs: 0,
max: 0,
message: '401: Too many requests.',
standardHeaders: true,
legacyHeaders: false
}
const config = {
development: {
port: process.env.SERVER_PORT || 3000,
admin_route: process.env.ADMIN_ROUTE || 'admin',
limiter: {
...limiterTemplate,
windowMs: process.env.RATE_LIMIT_TIMEOUT * 60 * 1000 || 0,
max: process.env.RATE_LIMIT_MAX || 1500
},
cache_interval: process.env.CACHE_INTERVAL * 60 * 1000 || 10 * 1000
},
staging: {
port: process.env.SERVER_PORT || 3001,
admin_route: process.env.ADMIN_ROUTE || 'admin',
limiter: {
...limiterTemplate,
windowMs: process.env.RATE_LIMIT_TIMEOUT * 60 * 1000 || 300000,
max: process.env.RATE_LIMIT_MAX || 100
},
cache_interval: process.env.CACHE_INTERVAL * 60 * 1000 || 15 * 60 * 1000
},
production: {
port: process.env.SERVER_PORT || 3002,
admin_route: process.env.ADMIN_ROUTE || 'admin',
limiter: {
...limiterTemplate,
windowMs: process.env.RATE_LIMIT_TIMEOUT * 60 * 1000 || 300000,
max: process.env.RATE_LIMIT_MAX || 100
},
cache_interval: process.env.CACHE_INTERVAL * 60 * 1000 || 15 * 60 * 1000
}
}
module.exports = config[NODE_ENV]
module.exports.ENV = NODE_ENV