]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/checker.js
Server: fix migration at installation
[github/Chocobozzz/PeerTube.git] / server / initializers / checker.js
index 7a2b5b132450eebb2f2d82d4e27a2050bf09310b..2a33009b4ed7b65f26529364b24b0c0d0d5bf415 100644 (file)
@@ -1,8 +1,10 @@
 'use strict'
 
 const config = require('config')
+const mongoose = require('mongoose')
 
-const Users = require('../models/users')
+const Client = mongoose.model('OAuthClient')
+const User = mongoose.model('User')
 
 const checker = {
   checkConfig: checkConfig,
@@ -15,8 +17,8 @@ function checkConfig () {
   const required = [ 'listen.port',
     'webserver.https', 'webserver.host', 'webserver.port',
     'database.host', 'database.port', 'database.suffix',
-    'storage.certs', 'storage.uploads', 'storage.logs',
-    'network.friends', 'electron.debug' ]
+    'storage.certs', 'storage.uploads', 'storage.logs', 'storage.thumbnails',
+    'electron.debug' ]
   const miss = []
 
   for (const key of required) {
@@ -29,7 +31,7 @@ function checkConfig () {
 }
 
 function clientsExist (callback) {
-  Users.getClients(function (err, clients) {
+  Client.list(function (err, clients) {
     if (err) return callback(err)
 
     return callback(null, clients.length !== 0)
@@ -37,10 +39,10 @@ function clientsExist (callback) {
 }
 
 function usersExist (callback) {
-  Users.getUsers(function (err, users) {
+  User.countTotal(function (err, totalUsers) {
     if (err) return callback(err)
 
-    return callback(null, users.length !== 0)
+    return callback(null, totalUsers !== 0)
   })
 }