X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fchecker.js;h=2753604dc43bb6eb492a177b666cd20a8a2b982c;hb=67bf9b96bbcd92b069fe86d9223fe0f8b9c6e677;hp=aea013fa9ab169a072f8f048c7cc7e151901ae86;hpb=6a94a109b4b89a97fe7bfeded3125fb7aad2ac3b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/checker.js b/server/initializers/checker.js index aea013fa9..2753604dc 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,7 +42,7 @@ function checkMissedConfig () { } function clientsExist (callback) { - Client.list(function (err, clients) { + db.OAuthClient.list(function (err, clients) { if (err) return callback(err) return callback(null, clients.length !== 0) @@ -52,7 +50,7 @@ function clientsExist (callback) { } function usersExist (callback) { - User.countTotal(function (err, totalUsers) { + db.User.countTotal(function (err, totalUsers) { if (err) return callback(err) return callback(null, totalUsers !== 0)