aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts22
1 files changed, 9 insertions, 13 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 6bdc261ad..1072d0de0 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -1,6 +1,9 @@
1import config = require('config') 1import config = require('config')
2import { join } from 'path' 2import { join } from 'path'
3 3
4// Do not use barrels, remain constants as independent as possible
5import { root, isTestInstance } from '../helpers/utils'
6
4// --------------------------------------------------------------------------- 7// ---------------------------------------------------------------------------
5 8
6const LAST_MIGRATION_VERSION = 50 9const LAST_MIGRATION_VERSION = 50
@@ -44,12 +47,12 @@ const CONFIG = {
44 PASSWORD: config.get<string>('database.password') 47 PASSWORD: config.get<string>('database.password')
45 }, 48 },
46 STORAGE: { 49 STORAGE: {
47 CERT_DIR: join(__dirname, '..', '..', config.get<string>('storage.certs')), 50 CERT_DIR: join(root(), config.get<string>('storage.certs')),
48 LOG_DIR: join(__dirname, '..', '..', config.get<string>('storage.logs')), 51 LOG_DIR: join(root(), config.get<string>('storage.logs')),
49 VIDEOS_DIR: join(__dirname, '..', '..', config.get<string>('storage.videos')), 52 VIDEOS_DIR: join(root(), config.get<string>('storage.videos')),
50 THUMBNAILS_DIR: join(__dirname, '..', '..', config.get<string>('storage.thumbnails')), 53 THUMBNAILS_DIR: join(root(), config.get<string>('storage.thumbnails')),
51 PREVIEWS_DIR: join(__dirname, '..', '..', config.get<string>('storage.previews')), 54 PREVIEWS_DIR: join(root(), config.get<string>('storage.previews')),
52 TORRENTS_DIR: join(__dirname, '..', '..', config.get<string>('storage.torrents')) 55 TORRENTS_DIR: join(root(), config.get<string>('storage.torrents'))
53 }, 56 },
54 WEBSERVER: { 57 WEBSERVER: {
55 SCHEME: config.get<boolean>('webserver.https') === true ? 'https' : 'http', 58 SCHEME: config.get<boolean>('webserver.https') === true ? 'https' : 'http',
@@ -334,10 +337,3 @@ export {
334 VIDEO_LICENCES, 337 VIDEO_LICENCES,
335 VIDEO_RATE_TYPES 338 VIDEO_RATE_TYPES
336} 339}
337
338// ---------------------------------------------------------------------------
339
340// This method exists in utils module but we want to let the constants module independent
341function isTestInstance () {
342 return (process.env.NODE_ENV === 'test')
343}