]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - initializers/constants.js
Infile code reorganization
[github/Chocobozzz/PeerTube.git] / initializers / constants.js
1 ;(function () {
2 'use strict'
3
4 // API version of our pod
5 var API_VERSION = 'v1'
6
7 // Score a pod has when we create it as a friend
8 var FRIEND_BASE_SCORE = 100
9
10 // Time to wait between requests to the friends
11 var INTERVAL = 60000
12
13 // Number of points we add/remove from a friend after a successful/bad request
14 var PODS_SCORE = {
15 MALUS: -10,
16 BONUS: 10
17 }
18
19 // Number of retries we make for the make retry requests (to friends...)
20 var REQUEST_RETRIES = 10
21
22 // Special constants for a test instance
23 if (isTestInstance() === true) {
24 FRIEND_BASE_SCORE = 20
25 INTERVAL = 10000
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
37 }
38
39 // ---------------------------------------------------------------------------
40
41 function isTestInstance () {
42 return (process.env.NODE_ENV === 'test')
43 }
44 })()