aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/checker.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-12 15:20:03 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-12 15:20:03 +0100
commit99fe265a5fc077cb66c322e7f3d191ff7110aea0 (patch)
treec9e04ccfcc5496d2300d7c26db5833e494b4cdad /server/initializers/checker.js
parentfcc5f77b95d330bfcb439c172b7fcc58f3162e4d (diff)
parent91cc839af88730ba55f84997c56b85ea100070a7 (diff)
downloadPeerTube-99fe265a5fc077cb66c322e7f3d191ff7110aea0.tar.gz
PeerTube-99fe265a5fc077cb66c322e7f3d191ff7110aea0.tar.zst
PeerTube-99fe265a5fc077cb66c322e7f3d191ff7110aea0.zip
Merge branch 'postgresql'
Diffstat (limited to 'server/initializers/checker.js')
-rw-r--r--server/initializers/checker.js12
1 files changed, 5 insertions, 7 deletions
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 @@
1'use strict' 1'use strict'
2 2
3const config = require('config') 3const config = require('config')
4const mongoose = require('mongoose')
5 4
6const Client = mongoose.model('OAuthClient') 5const db = require('./database')
7const User = mongoose.model('User')
8 6
9const checker = { 7const checker = {
10 checkConfig, 8 checkConfig,
@@ -29,7 +27,7 @@ function checkConfig () {
29function checkMissedConfig () { 27function checkMissedConfig () {
30 const required = [ 'listen.port', 28 const required = [ 'listen.port',
31 'webserver.https', 'webserver.hostname', 'webserver.port', 29 'webserver.https', 'webserver.hostname', 'webserver.port',
32 'database.hostname', 'database.port', 'database.suffix', 30 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
33 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews' 31 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews'
34 ] 32 ]
35 const miss = [] 33 const miss = []
@@ -44,15 +42,15 @@ function checkMissedConfig () {
44} 42}
45 43
46function clientsExist (callback) { 44function clientsExist (callback) {
47 Client.list(function (err, clients) { 45 db.OAuthClient.countTotal(function (err, totalClients) {
48 if (err) return callback(err) 46 if (err) return callback(err)
49 47
50 return callback(null, clients.length !== 0) 48 return callback(null, totalClients !== 0)
51 }) 49 })
52} 50}
53 51
54function usersExist (callback) { 52function usersExist (callback) {
55 User.countTotal(function (err, totalUsers) { 53 db.User.countTotal(function (err, totalUsers) {
56 if (err) return callback(err) 54 if (err) return callback(err)
57 55
58 return callback(null, totalUsers !== 0) 56 return callback(null, totalUsers !== 0)