diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-01-31 11:23:52 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-01-31 11:23:52 +0100 |
commit | c45f7f84001c2731909db04dd82e1c1f290386eb (patch) | |
tree | b7e57420a1f65dfbbacc1a532bf489c9bea6125d /initializers/constants.js | |
parent | cda021079ff455cc0fd0eb95a5395fa808ab63d1 (diff) | |
download | PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.tar.gz PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.tar.zst PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.zip |
Infile code reorganization
Diffstat (limited to 'initializers/constants.js')
-rw-r--r-- | initializers/constants.js | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/initializers/constants.js b/initializers/constants.js index 00b713961..1e101a747 100644 --- a/initializers/constants.js +++ b/initializers/constants.js | |||
@@ -1,37 +1,44 @@ | |||
1 | ;(function () { | 1 | ;(function () { |
2 | 'use strict' | 2 | 'use strict' |
3 | 3 | ||
4 | var constants = {} | ||
5 | |||
6 | function isTestInstance () { | ||
7 | return (process.env.NODE_ENV === 'test') | ||
8 | } | ||
9 | |||
10 | // API version of our pod | 4 | // API version of our pod |
11 | constants.API_VERSION = 'v1' | 5 | var API_VERSION = 'v1' |
12 | 6 | ||
13 | // Score a pod has when we create it as a friend | 7 | // Score a pod has when we create it as a friend |
14 | constants.FRIEND_BASE_SCORE = 100 | 8 | var FRIEND_BASE_SCORE = 100 |
15 | 9 | ||
16 | // Time to wait between requests to the friends | 10 | // Time to wait between requests to the friends |
17 | constants.INTERVAL = 60000 | 11 | var INTERVAL = 60000 |
18 | 12 | ||
19 | // 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 |
20 | constants.PODS_SCORE = { | 14 | var PODS_SCORE = { |
21 | MALUS: -10, | 15 | MALUS: -10, |
22 | BONUS: 10 | 16 | BONUS: 10 |
23 | } | 17 | } |
24 | 18 | ||
25 | // 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...) |
26 | constants.REQUEST_RETRIES = 10 | 20 | var REQUEST_RETRIES = 10 |
27 | 21 | ||
28 | // Special constants for a test instance | 22 | // Special constants for a test instance |
29 | if (isTestInstance() === true) { | 23 | if (isTestInstance() === true) { |
30 | constants.FRIEND_BASE_SCORE = 20 | 24 | FRIEND_BASE_SCORE = 20 |
31 | constants.INTERVAL = 10000 | 25 | INTERVAL = 10000 |
32 | constants.REQUEST_RETRIES = 2 | 26 | REQUEST_RETRIES = 2 |
27 | } | ||
28 | |||
29 | // --------------------------------------------------------------------------- | ||
30 | |||
31 | module.exports = { | ||
32 | API_VERSION: API_VERSION, | ||
33 | FRIEND_BASE_SCORE: FRIEND_BASE_SCORE, | ||
34 | INTERVAL: INTERVAL, | ||
35 | PODS_SCORE: PODS_SCORE, | ||
36 | REQUEST_RETRIES: REQUEST_RETRIES | ||
33 | } | 37 | } |
34 | 38 | ||
35 | // ----------- Export ----------- | 39 | // --------------------------------------------------------------------------- |
36 | module.exports = constants | 40 | |
41 | function isTestInstance () { | ||
42 | return (process.env.NODE_ENV === 'test') | ||
43 | } | ||
37 | })() | 44 | })() |