diff options
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -23,28 +23,29 @@ process.title = 'peertube' | |||
23 | // Create our main app | 23 | // Create our main app |
24 | const app = express() | 24 | const app = express() |
25 | 25 | ||
26 | // ----------- Database ----------- | 26 | // ----------- Core checker ----------- |
27 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | ||
28 | import { logger } from './server/helpers/logger' | ||
29 | import { API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' | ||
30 | // Initialize database and models | ||
31 | import { database as db } from './server/initializers/database' | ||
32 | db.init(false).then(() => onDatabaseInitDone()) | ||
33 | |||
34 | // ----------- Checker ----------- | ||
35 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' | 27 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' |
36 | 28 | ||
37 | const missed = checkMissedConfig() | 29 | const missed = checkMissedConfig() |
38 | if (missed.length !== 0) { | 30 | if (missed.length !== 0) { |
39 | throw new Error('Miss some configurations keys : ' + missed) | 31 | throw new Error('Your configuration files miss keys: ' + missed) |
40 | } | 32 | } |
41 | checkFFmpeg() | 33 | |
34 | import { API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' | ||
35 | checkFFmpeg(CONFIG) | ||
42 | 36 | ||
43 | const errorMessage = checkConfig() | 37 | const errorMessage = checkConfig() |
44 | if (errorMessage !== null) { | 38 | if (errorMessage !== null) { |
45 | throw new Error(errorMessage) | 39 | throw new Error(errorMessage) |
46 | } | 40 | } |
47 | 41 | ||
42 | // ----------- Database ----------- | ||
43 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | ||
44 | import { logger } from './server/helpers/logger' | ||
45 | // Initialize database and models | ||
46 | import { database as db } from './server/initializers/database' | ||
47 | db.init(false).then(() => onDatabaseInitDone()) | ||
48 | |||
48 | // ----------- PeerTube modules ----------- | 49 | // ----------- PeerTube modules ----------- |
49 | import { migrate, installApplication } from './server/initializers' | 50 | import { migrate, installApplication } from './server/initializers' |
50 | import { JobScheduler, activateSchedulers, VideosPreviewCache } from './server/lib' | 51 | import { JobScheduler, activateSchedulers, VideosPreviewCache } from './server/lib' |