diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2015-12-14 21:09:25 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2015-12-14 22:13:03 +0100 |
commit | 656ea8f70e848b03c0b668584dd533d72b376498 (patch) | |
tree | fa49512e3a3702a80d027838e5ab7486baca185a /src/constants.js | |
parent | 1d7974c758d363a0037c2a7ed05a0848d3c027a4 (diff) | |
download | PeerTube-656ea8f70e848b03c0b668584dd533d72b376498.tar.gz PeerTube-656ea8f70e848b03c0b668584dd533d72b376498.tar.zst PeerTube-656ea8f70e848b03c0b668584dd533d72b376498.zip |
Create a constants module to easily modify some constants in a test
instance for example.
Diffstat (limited to 'src/constants.js')
-rw-r--r-- | src/constants.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/constants.js b/src/constants.js new file mode 100644 index 000000000..00b713961 --- /dev/null +++ b/src/constants.js | |||
@@ -0,0 +1,37 @@ | |||
1 | ;(function () { | ||
2 | 'use strict' | ||
3 | |||
4 | var constants = {} | ||
5 | |||
6 | function isTestInstance () { | ||
7 | return (process.env.NODE_ENV === 'test') | ||
8 | } | ||
9 | |||
10 | // API version of our pod | ||
11 | constants.API_VERSION = 'v1' | ||
12 | |||
13 | // Score a pod has when we create it as a friend | ||
14 | constants.FRIEND_BASE_SCORE = 100 | ||
15 | |||
16 | // Time to wait between requests to the friends | ||
17 | constants.INTERVAL = 60000 | ||
18 | |||
19 | // Number of points we add/remove from a friend after a successful/bad request | ||
20 | constants.PODS_SCORE = { | ||
21 | MALUS: -10, | ||
22 | BONUS: 10 | ||
23 | } | ||
24 | |||
25 | // Number of retries we make for the make retry requests (to friends...) | ||
26 | constants.REQUEST_RETRIES = 10 | ||
27 | |||
28 | // Special constants for a test instance | ||
29 | if (isTestInstance() === true) { | ||
30 | constants.FRIEND_BASE_SCORE = 20 | ||
31 | constants.INTERVAL = 10000 | ||
32 | constants.REQUEST_RETRIES = 2 | ||
33 | } | ||
34 | |||
35 | // ----------- Export ----------- | ||
36 | module.exports = constants | ||
37 | })() | ||