mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 09:49:20 +02:00
Move to promises
Closes https://github.com/Chocobozzz/PeerTube/issues/74
This commit is contained in:
parent
5fe7e89831
commit
6fcd19ba73
88 changed files with 1980 additions and 2505 deletions
20
server.ts
20
server.ts
|
@ -29,7 +29,7 @@ import { logger } from './server/helpers/logger'
|
|||
import { API_VERSION, CONFIG } from './server/initializers/constants'
|
||||
// Initialize database and models
|
||||
import { database as db } from './server/initializers/database'
|
||||
db.init(false, onDatabaseInitDone)
|
||||
db.init(false).then(() => onDatabaseInitDone())
|
||||
|
||||
// ----------- Checker -----------
|
||||
import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker'
|
||||
|
@ -38,11 +38,7 @@ const missed = checkMissedConfig()
|
|||
if (missed.length !== 0) {
|
||||
throw new Error('Miss some configurations keys : ' + missed)
|
||||
}
|
||||
checkFFmpeg(function (err) {
|
||||
if (err) {
|
||||
throw err
|
||||
}
|
||||
})
|
||||
checkFFmpeg()
|
||||
|
||||
const errorMessage = checkConfig()
|
||||
if (errorMessage !== null) {
|
||||
|
@ -138,12 +134,11 @@ app.use(function (err, req, res, next) {
|
|||
function onDatabaseInitDone () {
|
||||
const port = CONFIG.LISTEN.PORT
|
||||
// Run the migration scripts if needed
|
||||
migrate(function (err) {
|
||||
if (err) throw err
|
||||
|
||||
installApplication(function (err) {
|
||||
if (err) throw err
|
||||
|
||||
migrate()
|
||||
.then(() => {
|
||||
return installApplication()
|
||||
})
|
||||
.then(() => {
|
||||
// ----------- Make the server listening -----------
|
||||
server.listen(port, function () {
|
||||
// Activate the communication with friends
|
||||
|
@ -156,5 +151,4 @@ function onDatabaseInitDone () {
|
|||
logger.info('Webserver: %s', CONFIG.WEBSERVER.URL)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue