From: Chocobozzz Date: Fri, 13 May 2016 19:34:47 +0000 (+0200) Subject: Use async series in installer for better readability X-Git-Tag: v0.0.1-alpha~925 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=cefc718dd6b6c0adafbb1e7de122217cffa25cd0;p=github%2FChocobozzz%2FPeerTube.git Use async series in installer for better readability --- diff --git a/server/initializers/installer.js b/server/initializers/installer.js index c2f5e47bc..53b07903c 100644 --- a/server/initializers/installer.js +++ b/server/initializers/installer.js @@ -16,21 +16,23 @@ const installer = { } function installApplication (callback) { - // Creates directories - createDirectoriesIfNotExist(function (err) { - if (err) return callback(err) - - // ----------- Create the certificates if they don't already exist ----------- - peertubeCrypto.createCertsIfNotExist(function (err) { - if (err) return callback(err) - - createOAuthClientIfNotExist(function (err) { - if (err) return callback(err) - - createOAuthUserIfNotExist(callback) - }) - }) - }) + async.series([ + function createDirectories (callbackAsync) { + createDirectoriesIfNotExist(callbackAsync) + }, + + function createCertificates (callbackAsync) { + peertubeCrypto.createCertsIfNotExist(callbackAsync) + }, + + function createOAuthClient (callbackAsync) { + createOAuthClientIfNotExist(callbackAsync) + }, + + function createOAuthUser (callbackAsync) { + createOAuthUserIfNotExist(callbackAsync) + } + ], callback) } // ---------------------------------------------------------------------------