]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/initializers/checker.js
7a2b5b132450eebb2f2d82d4e27a2050bf09310b
3 const config
= require('config')
5 const Users
= require('../models/users')
8 checkConfig: checkConfig
,
9 clientsExist: clientsExist
,
10 usersExist: usersExist
13 // Check the config files
14 function checkConfig () {
15 const required
= [ 'listen.port',
16 'webserver.https', 'webserver.host', 'webserver.port',
17 'database.host', 'database.port', 'database.suffix',
18 'storage.certs', 'storage.uploads', 'storage.logs',
19 'network.friends', 'electron.debug' ]
22 for (const key
of required
) {
23 if (!config
.has(key
)) {
31 function clientsExist (callback
) {
32 Users
.getClients(function (err
, clients
) {
33 if (err
) return callback(err
)
35 return callback(null, clients
.length
!== 0)
39 function usersExist (callback
) {
40 Users
.getUsers(function (err
, users
) {
41 if (err
) return callback(err
)
43 return callback(null, users
.length
!== 0)
47 // ---------------------------------------------------------------------------
49 module
.exports
= checker