]>
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', 'database.username', 'database.password',
31 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews',
36 for (const key
of required
) {
37 if (!config
.has(key
)) {
45 function clientsExist (callback
) {
46 db
.OAuthClient
.countTotal(function (err
, totalClients
) {
47 if (err
) return callback(err
)
49 return callback(null, totalClients
!== 0)
53 function usersExist (callback
) {
54 db
.User
.countTotal(function (err
, totalUsers
) {
55 if (err
) return callback(err
)
57 return callback(null, totalUsers
!== 0)
61 // ---------------------------------------------------------------------------
63 module
.exports
= checker