diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-22 20:58:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-25 17:32:16 +0200 |
commit | e02643f32e4c97ca307f8fc5b69be79c40d70a3b (patch) | |
tree | b7f6269913cd5a0e4f26a9461a043deb0c168be0 /server/initializers/constants.ts | |
parent | 65fcc3119c334b75dd13bcfdebf186afdc580a8f (diff) | |
download | PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.gz PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.zst PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.zip |
Type models
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 22 |
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 @@ | |||
1 | import config = require('config') | 1 | import config = require('config') |
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | 3 | ||
4 | // Do not use barrels, remain constants as independent as possible | ||
5 | import { root, isTestInstance } from '../helpers/utils' | ||
6 | |||
4 | // --------------------------------------------------------------------------- | 7 | // --------------------------------------------------------------------------- |
5 | 8 | ||
6 | const LAST_MIGRATION_VERSION = 50 | 9 | const 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 | ||
341 | function isTestInstance () { | ||
342 | return (process.env.NODE_ENV === 'test') | ||
343 | } | ||