From cefc718dd6b6c0adafbb1e7de122217cffa25cd0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 13 May 2016 21:34:47 +0200 Subject: Use async series in installer for better readability --- server/initializers/installer.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'server') 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) } // --------------------------------------------------------------------------- -- cgit v1.2.3