]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/initializers/checker.js
3 const config
= require('config')
5 const db
= require('./database')
14 // Some checks on configuration files
15 function checkConfig () {
16 if (config
.has('webserver.host')) {
17 let errorMessage
= '`host` config key was renamed to `hostname` but it seems you still have a `host` key in your configuration files!'
18 errorMessage
+= ' Please ensure to rename your `host` configuration to `hostname`.'
26 // Check the config files
27 function checkMissedConfig () {
28 const required
= [ 'listen.port',
29 'webserver.https', 'webserver.hostname', 'webserver.port',
30 'database.hostname', 'database.port', 'database.suffix',
31 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews'
35 for (const key
of required
) {
36 if (!config
.has(key
)) {
44 function clientsExist (callback
) {
45 db
.OAuthClient
.list(function (err
, clients
) {
46 if (err
) return callback(err
)
48 return callback(null, clients
.length
!== 0)
52 function usersExist (callback
) {
53 db
.User
.countTotal(function (err
, totalUsers
) {
54 if (err
) return callback(err
)
56 return callback(null, totalUsers
!== 0)
60 // ---------------------------------------------------------------------------
62 module
.exports
= checker