-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
config.js
59 lines (56 loc) · 2.58 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
/**
* File managing configuration for the application
* */
const dotenv = require('dotenv');
const fs = require('fs');
if (fs.existsSync('.env')) {
dotenv.config();
}
const defaults = {
HYPIXEL_API_KEY: '', // To get your API key, type '/api' on Hypixel
HYPIXEL_API_LIMIT: 120, // API key throttle limit
ROLE: '', // for specifying the file that should be run when entry point is invoked
GROUP: '', // for specifying the group of apps that should be run when entry point is invoked
NODE_ENV: 'development',
FRONTEND_PORT: 5000,
REDIS_URL: 'redis://127.0.0.1:6379/0', // connection string for Redis
SENTRY_URL: '',
API_FREE_LIMIT: 50000, // number of api requests per month before 429 is returned.
NO_API_KEY_PER_MIN_LIMIT: 60, // Rate limit per minute if not using an API key
DEFAULT_DELAY: 1000, // delay between API requests
ENABLE_UUID_CACHE: true, // cache player stats
ENABLE_PLAYER_CACHE: true, // cache players
ENABLE_GUILD_CACHE: true, // cache guilds
ENABLE_BANS_CACHE: true, // cache bans
ENABLE_BOOSTERS_CACHE: true, // cache boosters
ENABLE_COUNTS_STASH: true, // cache counts
ENABLE_LEADERBOARD_CACHE: true, // cache leaderboards
ENABLE_AUCTION_CACHE: true, // cache auctions
UUID_CACHE_SECONDS: 21600, // number of seconds to cache username-uuid pairs
PLAYER_CACHE_SECONDS: 600, // number of seconds to cache players
GUILD_CACHE_SECONDS: 600, // number of seconds to cache guilds
BANS_CACHE_SECONDS: 30, // number of seconds to cache bans
BOOSTERS_CACHE_SECONDS: 30, // number of seconds to cache boosters
COUNTS_CACHE_SECONDS: 60, // number of seconds to cache counts
STATUS_CACHE_SECONDS: 60, // number of seconds to cache player status
LEADERBOARD_CACHE_SECONDS: 900, // number of seconds to cache each leaderboard
AUCTION_CACHE_SECONDS: 60,
CONCURRENT_REQUEST_LIMIT: 20, // max number of auction pages to concurrently fetch
};
// ensure that process.env has all values in defaults, but prefer the process.env value
Object.keys(defaults).forEach((key) => {
process.env[key] = (key in process.env) ? process.env[key] : defaults[key];
});
if (process.env.NODE_ENV === 'development') {
// force PORT to null in development so we can run multiple web services without conflict
// process.env.PORT = '';
}
if (process.env.NODE_ENV === 'test') {
process.env.PORT = ''; // use service default
process.env.DEFAULT_DELAY = 0;
// process.env.REDIS_URL = process.env.REDIS_TEST_URL;
process.env.SESSION_SECRET = 'testsecretvalue';
process.env.FRONTEND_PORT = 5001;
}
// now processes can use either process.env or config
module.exports = process.env;