aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts20
1 files changed, 7 insertions, 13 deletions
diff --git a/server.ts b/server.ts
index 60045865d..e7fa99c90 100644
--- a/server.ts
+++ b/server.ts
@@ -29,7 +29,7 @@ import { logger } from './server/helpers/logger'
29import { API_VERSION, CONFIG } from './server/initializers/constants' 29import { API_VERSION, CONFIG } from './server/initializers/constants'
30// Initialize database and models 30// Initialize database and models
31import { database as db } from './server/initializers/database' 31import { database as db } from './server/initializers/database'
32db.init(false, onDatabaseInitDone) 32db.init(false).then(() => onDatabaseInitDone())
33 33
34// ----------- Checker ----------- 34// ----------- Checker -----------
35import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' 35import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker'
@@ -38,11 +38,7 @@ const missed = checkMissedConfig()
38if (missed.length !== 0) { 38if (missed.length !== 0) {
39 throw new Error('Miss some configurations keys : ' + missed) 39 throw new Error('Miss some configurations keys : ' + missed)
40} 40}
41checkFFmpeg(function (err) { 41checkFFmpeg()
42 if (err) {
43 throw err
44 }
45})
46 42
47const errorMessage = checkConfig() 43const errorMessage = checkConfig()
48if (errorMessage !== null) { 44if (errorMessage !== null) {
@@ -138,12 +134,11 @@ app.use(function (err, req, res, next) {
138function onDatabaseInitDone () { 134function onDatabaseInitDone () {
139 const port = CONFIG.LISTEN.PORT 135 const port = CONFIG.LISTEN.PORT
140 // Run the migration scripts if needed 136 // Run the migration scripts if needed
141 migrate(function (err) { 137 migrate()
142 if (err) throw err 138 .then(() => {
143 139 return installApplication()
144 installApplication(function (err) { 140 })
145 if (err) throw err 141 .then(() => {
146
147 // ----------- Make the server listening ----------- 142 // ----------- Make the server listening -----------
148 server.listen(port, function () { 143 server.listen(port, function () {
149 // Activate the communication with friends 144 // Activate the communication with friends
@@ -156,5 +151,4 @@ function onDatabaseInitDone () {
156 logger.info('Webserver: %s', CONFIG.WEBSERVER.URL) 151 logger.info('Webserver: %s', CONFIG.WEBSERVER.URL)
157 }) 152 })
158 }) 153 })
159 })
160} 154}