diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.ts | 13 | ||||
-rw-r--r-- | server/initializers/installer.ts | 10 |
2 files changed, 15 insertions, 8 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 7fac8a4d6..7a3ec3874 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -660,7 +660,7 @@ const EMBED_SIZE = { | |||
660 | } | 660 | } |
661 | 661 | ||
662 | // Sub folders of cache directory | 662 | // Sub folders of cache directory |
663 | const CACHE = { | 663 | const FILES_CACHE = { |
664 | PREVIEWS: { | 664 | PREVIEWS: { |
665 | DIRECTORY: join(CONFIG.STORAGE.CACHE_DIR, 'previews'), | 665 | DIRECTORY: join(CONFIG.STORAGE.CACHE_DIR, 'previews'), |
666 | MAX_AGE: 1000 * 3600 * 3 // 3 hours | 666 | MAX_AGE: 1000 * 3600 * 3 // 3 hours |
@@ -671,6 +671,12 @@ const CACHE = { | |||
671 | } | 671 | } |
672 | } | 672 | } |
673 | 673 | ||
674 | const CACHE = { | ||
675 | USER_TOKENS: { | ||
676 | MAX_SIZE: 10000 | ||
677 | } | ||
678 | } | ||
679 | |||
674 | const HLS_STREAMING_PLAYLIST_DIRECTORY = join(CONFIG.STORAGE.STREAMING_PLAYLISTS_DIR, 'hls') | 680 | const HLS_STREAMING_PLAYLIST_DIRECTORY = join(CONFIG.STORAGE.STREAMING_PLAYLISTS_DIR, 'hls') |
675 | const HLS_REDUNDANCY_DIRECTORY = join(CONFIG.STORAGE.REDUNDANCY_DIR, 'hls') | 681 | const HLS_REDUNDANCY_DIRECTORY = join(CONFIG.STORAGE.REDUNDANCY_DIR, 'hls') |
676 | 682 | ||
@@ -741,7 +747,7 @@ if (isTestInstance() === true) { | |||
741 | 747 | ||
742 | JOB_ATTEMPTS['email'] = 1 | 748 | JOB_ATTEMPTS['email'] = 1 |
743 | 749 | ||
744 | CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000 | 750 | FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000 |
745 | MEMOIZE_TTL.OVERVIEWS_SAMPLE = 1 | 751 | MEMOIZE_TTL.OVERVIEWS_SAMPLE = 1 |
746 | ROUTE_CACHE_LIFETIME.OVERVIEWS.VIDEOS = '0ms' | 752 | ROUTE_CACHE_LIFETIME.OVERVIEWS.VIDEOS = '0ms' |
747 | 753 | ||
@@ -759,7 +765,7 @@ export { | |||
759 | ACCEPT_HEADERS, | 765 | ACCEPT_HEADERS, |
760 | BCRYPT_SALT_SIZE, | 766 | BCRYPT_SALT_SIZE, |
761 | TRACKER_RATE_LIMITS, | 767 | TRACKER_RATE_LIMITS, |
762 | CACHE, | 768 | FILES_CACHE, |
763 | CONFIG, | 769 | CONFIG, |
764 | CONSTRAINTS_FIELDS, | 770 | CONSTRAINTS_FIELDS, |
765 | EMBED_SIZE, | 771 | EMBED_SIZE, |
@@ -799,6 +805,7 @@ export { | |||
799 | VIDEO_TRANSCODING_FPS, | 805 | VIDEO_TRANSCODING_FPS, |
800 | FFMPEG_NICE, | 806 | FFMPEG_NICE, |
801 | VIDEO_ABUSE_STATES, | 807 | VIDEO_ABUSE_STATES, |
808 | CACHE, | ||
802 | JOB_REQUEST_TIMEOUT, | 809 | JOB_REQUEST_TIMEOUT, |
803 | USER_PASSWORD_RESET_LIFETIME, | 810 | USER_PASSWORD_RESET_LIFETIME, |
804 | MEMOIZE_TTL, | 811 | MEMOIZE_TTL, |
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index cd2c942fd..07af96b68 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -6,7 +6,7 @@ import { UserModel } from '../models/account/user' | |||
6 | import { ApplicationModel } from '../models/application/application' | 6 | import { ApplicationModel } from '../models/application/application' |
7 | import { OAuthClientModel } from '../models/oauth/oauth-client' | 7 | import { OAuthClientModel } from '../models/oauth/oauth-client' |
8 | import { applicationExist, clientsExist, usersExist } from './checker-after-init' | 8 | import { applicationExist, clientsExist, usersExist } from './checker-after-init' |
9 | import { CACHE, CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants' | 9 | import { FILES_CACHE, CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants' |
10 | import { sequelizeTypescript } from './database' | 10 | import { sequelizeTypescript } from './database' |
11 | import { remove, ensureDir } from 'fs-extra' | 11 | import { remove, ensureDir } from 'fs-extra' |
12 | 12 | ||
@@ -42,8 +42,8 @@ export { | |||
42 | // --------------------------------------------------------------------------- | 42 | // --------------------------------------------------------------------------- |
43 | 43 | ||
44 | function removeCacheAndTmpDirectories () { | 44 | function removeCacheAndTmpDirectories () { |
45 | const cacheDirectories = Object.keys(CACHE) | 45 | const cacheDirectories = Object.keys(FILES_CACHE) |
46 | .map(k => CACHE[k].DIRECTORY) | 46 | .map(k => FILES_CACHE[k].DIRECTORY) |
47 | 47 | ||
48 | const tasks: Promise<any>[] = [] | 48 | const tasks: Promise<any>[] = [] |
49 | 49 | ||
@@ -60,8 +60,8 @@ function removeCacheAndTmpDirectories () { | |||
60 | 60 | ||
61 | function createDirectoriesIfNotExist () { | 61 | function createDirectoriesIfNotExist () { |
62 | const storage = CONFIG.STORAGE | 62 | const storage = CONFIG.STORAGE |
63 | const cacheDirectories = Object.keys(CACHE) | 63 | const cacheDirectories = Object.keys(FILES_CACHE) |
64 | .map(k => CACHE[k].DIRECTORY) | 64 | .map(k => FILES_CACHE[k].DIRECTORY) |
65 | 65 | ||
66 | const tasks: Promise<void>[] = [] | 66 | const tasks: Promise<void>[] = [] |
67 | for (const key of Object.keys(storage)) { | 67 | for (const key of Object.keys(storage)) { |