diff options
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -27,13 +27,21 @@ const app = express() | |||
27 | // ----------- Core checker ----------- | 27 | // ----------- Core checker ----------- |
28 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' | 28 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' |
29 | 29 | ||
30 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | ||
31 | import { logger } from './server/helpers/logger' | ||
32 | import { ACCEPT_HEADERS, API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' | ||
33 | |||
30 | const missed = checkMissedConfig() | 34 | const missed = checkMissedConfig() |
31 | if (missed.length !== 0) { | 35 | if (missed.length !== 0) { |
32 | throw new Error('Your configuration files miss keys: ' + missed) | 36 | logger.error('Your configuration files miss keys: ' + missed) |
37 | process.exit(-1) | ||
33 | } | 38 | } |
34 | 39 | ||
35 | import { ACCEPT_HEADERS, API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' | ||
36 | checkFFmpeg(CONFIG) | 40 | checkFFmpeg(CONFIG) |
41 | .catch(err => { | ||
42 | logger.error('Error in ffmpeg check.', { err }) | ||
43 | process.exit(-1) | ||
44 | }) | ||
37 | 45 | ||
38 | const errorMessage = checkConfig() | 46 | const errorMessage = checkConfig() |
39 | if (errorMessage !== null) { | 47 | if (errorMessage !== null) { |
@@ -41,8 +49,6 @@ if (errorMessage !== null) { | |||
41 | } | 49 | } |
42 | 50 | ||
43 | // ----------- Database ----------- | 51 | // ----------- Database ----------- |
44 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | ||
45 | import { logger } from './server/helpers/logger' | ||
46 | 52 | ||
47 | // Initialize database and models | 53 | // Initialize database and models |
48 | import { initDatabaseModels } from './server/initializers/database' | 54 | import { initDatabaseModels } from './server/initializers/database' |