Use async series in installer for better readability

pull/10/head
Chocobozzz 2016-05-13 21:34:47 +02:00
parent 1cad0f395f
commit cefc718dd6
1 changed files with 14 additions and 12 deletions

View File

@ -16,21 +16,23 @@ const installer = {
} }
function installApplication (callback) { function installApplication (callback) {
// Creates directories async.series([
createDirectoriesIfNotExist(function (err) { function createDirectories (callbackAsync) {
if (err) return callback(err) createDirectoriesIfNotExist(callbackAsync)
},
// ----------- Create the certificates if they don't already exist ----------- function createCertificates (callbackAsync) {
peertubeCrypto.createCertsIfNotExist(function (err) { peertubeCrypto.createCertsIfNotExist(callbackAsync)
if (err) return callback(err) },
createOAuthClientIfNotExist(function (err) { function createOAuthClient (callbackAsync) {
if (err) return callback(err) createOAuthClientIfNotExist(callbackAsync)
},
createOAuthUserIfNotExist(callback) function createOAuthUser (callbackAsync) {
}) createOAuthUserIfNotExist(callbackAsync)
}) }
}) ], callback)
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------