X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fchecker.js;h=6471bb4f11fcb940d3833d61743951d777b014bd;hb=dea32aacde362a5fbd62a88cd32487768b788468;hp=aea013fa9ab169a072f8f048c7cc7e151901ae86;hpb=6a94a109b4b89a97fe7bfeded3125fb7aad2ac3b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/checker.js b/server/initializers/checker.js index aea013fa9..6471bb4f1 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,7 +27,7 @@ function checkConfig () { function checkMissedConfig () { const required = [ 'listen.port', 'webserver.https', 'webserver.hostname', 'webserver.port', - 'database.hostname', 'database.port', 'database.suffix', + 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews' ] const miss = [] @@ -44,15 +42,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)