aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-12 11:56:02 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-12 11:56:02 +0200
commitf981dae8617271a2dc713bb683951730b306e0c5 (patch)
treeecee631766bc1b98c20a7836479fed40850c5a56 /server/initializers/constants.ts
parent075f16caac5236cb04c98ae7b3a989766d764bb3 (diff)
downloadPeerTube-f981dae8617271a2dc713bb683951730b306e0c5.tar.gz
PeerTube-f981dae8617271a2dc713bb683951730b306e0c5.tar.zst
PeerTube-f981dae8617271a2dc713bb683951730b306e0c5.zip
Add previews cache system between pods
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index f087b7476..928a3f570 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -61,7 +61,8 @@ const CONFIG = {
61 VIDEOS_DIR: join(root(), config.get<string>('storage.videos')), 61 VIDEOS_DIR: join(root(), config.get<string>('storage.videos')),
62 THUMBNAILS_DIR: join(root(), config.get<string>('storage.thumbnails')), 62 THUMBNAILS_DIR: join(root(), config.get<string>('storage.thumbnails')),
63 PREVIEWS_DIR: join(root(), config.get<string>('storage.previews')), 63 PREVIEWS_DIR: join(root(), config.get<string>('storage.previews')),
64 TORRENTS_DIR: join(root(), config.get<string>('storage.torrents')) 64 TORRENTS_DIR: join(root(), config.get<string>('storage.torrents')),
65 CACHE_DIR: join(root(), config.get<string>('storage.cache'))
65 }, 66 },
66 WEBSERVER: { 67 WEBSERVER: {
67 SCHEME: config.get<boolean>('webserver.https') === true ? 'https' : 'http', 68 SCHEME: config.get<boolean>('webserver.https') === true ? 'https' : 'http',
@@ -80,6 +81,11 @@ const CONFIG = {
80 TRANSCODING: { 81 TRANSCODING: {
81 ENABLED: config.get<boolean>('transcoding.enabled'), 82 ENABLED: config.get<boolean>('transcoding.enabled'),
82 THREADS: config.get<number>('transcoding.threads') 83 THREADS: config.get<number>('transcoding.threads')
84 },
85 CACHE: {
86 PREVIEWS: {
87 SIZE: config.get<number>('cache.previews.size')
88 }
83 } 89 }
84} 90}
85CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT 91CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
@@ -278,6 +284,13 @@ let STATIC_MAX_AGE = '30d'
278const THUMBNAILS_SIZE = '200x110' 284const THUMBNAILS_SIZE = '200x110'
279const PREVIEWS_SIZE = '640x480' 285const PREVIEWS_SIZE = '640x480'
280 286
287// Subfolders of cache directory
288const CACHE = {
289 DIRECTORIES: {
290 PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews')
291 }
292}
293
281// --------------------------------------------------------------------------- 294// ---------------------------------------------------------------------------
282 295
283const USER_ROLES: { [ id: string ]: UserRole } = { 296const USER_ROLES: { [ id: string ]: UserRole } = {
@@ -307,6 +320,7 @@ if (isTestInstance() === true) {
307export { 320export {
308 API_VERSION, 321 API_VERSION,
309 BCRYPT_SALT_SIZE, 322 BCRYPT_SALT_SIZE,
323 CACHE,
310 CONFIG, 324 CONFIG,
311 CONSTRAINTS_FIELDS, 325 CONSTRAINTS_FIELDS,
312 FRIEND_SCORE, 326 FRIEND_SCORE,