aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/checker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/checker.ts')
-rw-r--r--server/initializers/checker.ts21
1 files changed, 12 insertions, 9 deletions
diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts
index e4ca26f9c..97606ef31 100644
--- a/server/initializers/checker.ts
+++ b/server/initializers/checker.ts
@@ -1,8 +1,8 @@
1import * as config from 'config' 1import * as config from 'config'
2 2
3import { database as db } from './database'
4import { CONFIG } from './constants'
5import { promisify0 } from '../helpers/core-utils' 3import { promisify0 } from '../helpers/core-utils'
4import { OAuthClientModel } from '../models/oauth/oauth-client-interface'
5import { UserModel } from '../models/user/user-interface'
6 6
7// Some checks on configuration files 7// Some checks on configuration files
8function checkConfig () { 8function checkConfig () {
@@ -21,8 +21,8 @@ function checkMissedConfig () {
21 const required = [ 'listen.port', 21 const required = [ 'listen.port',
22 'webserver.https', 'webserver.hostname', 'webserver.port', 22 'webserver.https', 'webserver.hostname', 'webserver.port',
23 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', 23 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
24 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews', 24 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews', 'storage.torrents', 'storage.cache',
25 'admin.email', 'signup.enabled', 'transcoding.enabled', 'transcoding.threads' 25 'cache.previews.size', 'admin.email', 'signup.enabled', 'signup.limit', 'transcoding.enabled', 'transcoding.threads'
26 ] 26 ]
27 const miss: string[] = [] 27 const miss: string[] = []
28 28
@@ -36,7 +36,8 @@ function checkMissedConfig () {
36} 36}
37 37
38// Check the available codecs 38// Check the available codecs
39function checkFFmpeg () { 39// We get CONFIG by param to not import it in this file (import orders)
40function checkFFmpeg (CONFIG: { TRANSCODING: { ENABLED: boolean } }) {
40 const Ffmpeg = require('fluent-ffmpeg') 41 const Ffmpeg = require('fluent-ffmpeg')
41 const getAvailableCodecsPromise = promisify0(Ffmpeg.getAvailableCodecs) 42 const getAvailableCodecsPromise = promisify0(Ffmpeg.getAvailableCodecs)
42 43
@@ -57,14 +58,16 @@ function checkFFmpeg () {
57 }) 58 })
58} 59}
59 60
60function clientsExist () { 61// We get db by param to not import it in this file (import orders)
61 return db.OAuthClient.countTotal().then(totalClients => { 62function clientsExist (OAuthClient: OAuthClientModel) {
63 return OAuthClient.countTotal().then(totalClients => {
62 return totalClients !== 0 64 return totalClients !== 0
63 }) 65 })
64} 66}
65 67
66function usersExist () { 68// We get db by param to not import it in this file (import orders)
67 return db.User.countTotal().then(totalUsers => { 69function usersExist (User: UserModel) {
70 return User.countTotal().then(totalUsers => {
68 return totalUsers !== 0 71 return totalUsers !== 0
69 }) 72 })
70} 73}