diff options
Diffstat (limited to 'initializers/constants.js')
-rw-r--r-- | initializers/constants.js | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/initializers/constants.js b/initializers/constants.js index 1e101a747..16e50443b 100644 --- a/initializers/constants.js +++ b/initializers/constants.js | |||
@@ -1,44 +1,42 @@ | |||
1 | ;(function () { | 1 | 'use strict' |
2 | 'use strict' | 2 | |
3 | 3 | // API version of our pod | |
4 | // API version of our pod | 4 | var API_VERSION = 'v1' |
5 | var API_VERSION = 'v1' | 5 | |
6 | 6 | // Score a pod has when we create it as a friend | |
7 | // Score a pod has when we create it as a friend | 7 | var FRIEND_BASE_SCORE = 100 |
8 | var FRIEND_BASE_SCORE = 100 | 8 | |
9 | 9 | // Time to wait between requests to the friends | |
10 | // Time to wait between requests to the friends | 10 | var INTERVAL = 60000 |
11 | var INTERVAL = 60000 | 11 | |
12 | 12 | // Number of points we add/remove from a friend after a successful/bad request | |
13 | // Number of points we add/remove from a friend after a successful/bad request | 13 | var PODS_SCORE = { |
14 | var PODS_SCORE = { | 14 | MALUS: -10, |
15 | MALUS: -10, | 15 | BONUS: 10 |
16 | BONUS: 10 | 16 | } |
17 | } | 17 | |
18 | 18 | // Number of retries we make for the make retry requests (to friends...) | |
19 | // Number of retries we make for the make retry requests (to friends...) | 19 | var REQUEST_RETRIES = 10 |
20 | var REQUEST_RETRIES = 10 | 20 | |
21 | 21 | // Special constants for a test instance | |
22 | // Special constants for a test instance | 22 | if (isTestInstance() === true) { |
23 | if (isTestInstance() === true) { | 23 | FRIEND_BASE_SCORE = 20 |
24 | FRIEND_BASE_SCORE = 20 | 24 | INTERVAL = 10000 |
25 | INTERVAL = 10000 | 25 | REQUEST_RETRIES = 2 |
26 | REQUEST_RETRIES = 2 | 26 | } |
27 | } | 27 | |
28 | 28 | // --------------------------------------------------------------------------- | |
29 | // --------------------------------------------------------------------------- | 29 | |
30 | 30 | module.exports = { | |
31 | module.exports = { | 31 | API_VERSION: API_VERSION, |
32 | API_VERSION: API_VERSION, | 32 | FRIEND_BASE_SCORE: FRIEND_BASE_SCORE, |
33 | FRIEND_BASE_SCORE: FRIEND_BASE_SCORE, | 33 | INTERVAL: INTERVAL, |
34 | INTERVAL: INTERVAL, | 34 | PODS_SCORE: PODS_SCORE, |
35 | PODS_SCORE: PODS_SCORE, | 35 | REQUEST_RETRIES: REQUEST_RETRIES |
36 | REQUEST_RETRIES: REQUEST_RETRIES | 36 | } |
37 | } | 37 | |
38 | 38 | // --------------------------------------------------------------------------- | |
39 | // --------------------------------------------------------------------------- | 39 | |
40 | 40 | function isTestInstance () { | |
41 | function isTestInstance () { | 41 | return (process.env.NODE_ENV === 'test') |
42 | return (process.env.NODE_ENV === 'test') | 42 | } |
43 | } | ||
44 | })() | ||