]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/initializers/constants.js
Move the count of results for the pagination in constants module
[github/Chocobozzz/PeerTube.git] / server / initializers / constants.js
1 'use strict'
2
3 // API version of our pod
4 const API_VERSION = 'v1'
5
6 // Score a pod has when we create it as a friend
7 let FRIEND_BASE_SCORE = 100
8
9 // Time to wait between requests to the friends
10 let INTERVAL = 60000
11
12 // Number of results by default for the pagination
13 const PAGINATION_COUNT_DEFAULT = 15
14
15 // Number of points we add/remove from a friend after a successful/bad request
16 const PODS_SCORE = {
17 MALUS: -10,
18 BONUS: 10
19 }
20
21 // Number of retries we make for the make retry requests (to friends...)
22 let REQUEST_RETRIES = 10
23
24 // Videos thumbnail size
25 const THUMBNAILS_SIZE = '200x110'
26
27 // Path for access to thumbnails with express router
28 const THUMBNAILS_STATIC_PATH = '/static/thumbnails'
29
30 // Special constants for a test instance
31 if (isTestInstance() === true) {
32 FRIEND_BASE_SCORE = 20
33 INTERVAL = 10000
34 REQUEST_RETRIES = 2
35 }
36
37 // ---------------------------------------------------------------------------
38
39 module.exports = {
40 API_VERSION: API_VERSION,
41 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
42 INTERVAL: INTERVAL,
43 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
44 PODS_SCORE: PODS_SCORE,
45 REQUEST_RETRIES: REQUEST_RETRIES,
46 THUMBNAILS_SIZE: THUMBNAILS_SIZE,
47 THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH
48 }
49
50 // ---------------------------------------------------------------------------
51
52 function isTestInstance () {
53 return (process.env.NODE_ENV === 'test')
54 }