X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fchecker.js;h=7adbbb37a2569600328f70343150bfc12029f481;hb=e4c87ec26962e359d1c70b03ed188a3f19d6a25b;hp=aea013fa9ab169a072f8f048c7cc7e151901ae86;hpb=6a94a109b4b89a97fe7bfeded3125fb7aad2ac3b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/checker.js b/server/initializers/checker.js index aea013fa9..7adbbb37a 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js @@ -1,10 +1,8 @@ 'use strict' const config = require('config') -const mongoose = require('mongoose') -const Client = mongoose.model('OAuthClient') -const User = mongoose.model('User') +const db = require('./database') const checker = { checkConfig, @@ -29,8 +27,9 @@ function checkConfig () { function checkMissedConfig () { const required = [ 'listen.port', 'webserver.https', 'webserver.hostname', 'webserver.port', - 'database.hostname', 'database.port', 'database.suffix', - 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews' + 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', + 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews', + 'admin.email' ] const miss = [] @@ -44,15 +43,15 @@ function checkMissedConfig () { } function clientsExist (callback) { - Client.list(function (err, clients) { + db.OAuthClient.countTotal(function (err, totalClients) { if (err) return callback(err) - return callback(null, clients.length !== 0) + return callback(null, totalClients !== 0) }) } function usersExist (callback) { - User.countTotal(function (err, totalUsers) { + db.User.countTotal(function (err, totalUsers) { if (err) return callback(err) return callback(null, totalUsers !== 0)