diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-11 21:50:51 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-19 21:22:28 +0100 |
commit | feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch) | |
tree | 2abc9fbc9569760e218fd52835850b757344b420 /server/initializers/checker.js | |
parent | 108626609eda75e4ecc0a83a650a4d53c46220e0 (diff) | |
download | PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.gz PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.zst PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.zip |
First version with PostgreSQL
Diffstat (limited to 'server/initializers/checker.js')
-rw-r--r-- | server/initializers/checker.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/server/initializers/checker.js b/server/initializers/checker.js index aea013fa9..7b402de82 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js | |||
@@ -1,10 +1,8 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const config = require('config') | 3 | const config = require('config') |
4 | const mongoose = require('mongoose') | ||
5 | 4 | ||
6 | const Client = mongoose.model('OAuthClient') | 5 | const db = require('./database') |
7 | const User = mongoose.model('User') | ||
8 | 6 | ||
9 | const checker = { | 7 | const checker = { |
10 | checkConfig, | 8 | checkConfig, |
@@ -44,7 +42,7 @@ function checkMissedConfig () { | |||
44 | } | 42 | } |
45 | 43 | ||
46 | function clientsExist (callback) { | 44 | function clientsExist (callback) { |
47 | Client.list(function (err, clients) { | 45 | db.OAuthClient.list(function (err, clients) { |
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, clients.length !== 0) |
@@ -52,7 +50,7 @@ function clientsExist (callback) { | |||
52 | } | 50 | } |
53 | 51 | ||
54 | function usersExist (callback) { | 52 | function 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) |