aboutsummaryrefslogtreecommitdiffhomepage
path: root/initializers/checker.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-02-07 11:23:23 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-02-07 11:23:23 +0100
commit9f10b2928df655c3672d9607e864e667d4bc903a (patch)
tree7743911b974b3a7fb0d4c7cec2a723942466b7f1 /initializers/checker.js
parentd7c01e7793d813d804a3b5716d8288f9dcf71a16 (diff)
downloadPeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.tar.gz
PeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.tar.zst
PeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.zip
Remove useless anonymous functions of files
Diffstat (limited to 'initializers/checker.js')
-rw-r--r--initializers/checker.js84
1 files changed, 41 insertions, 43 deletions
diff --git a/initializers/checker.js b/initializers/checker.js
index f4458c5cf..9a7d04ed4 100644
--- a/initializers/checker.js
+++ b/initializers/checker.js
@@ -1,50 +1,48 @@
1;(function () { 1'use strict'
2 'use strict' 2
3 3var config = require('config')
4 var config = require('config') 4var mkdirp = require('mkdirp')
5 var mkdirp = require('mkdirp') 5var path = require('path')
6 var path = require('path') 6
7 7var checker = {
8 var checker = { 8 checkConfig: checkConfig,
9 checkConfig: checkConfig, 9 createDirectoriesIfNotExist: createDirectoriesIfNotExist
10 createDirectoriesIfNotExist: createDirectoriesIfNotExist 10}
11 } 11
12 12// Check the config files
13 // Check the config files 13function checkConfig () {
14 function checkConfig () { 14 var required = [ 'listen.port',
15 var required = [ 'listen.port', 15 'webserver.https', 'webserver.host', 'webserver.port',
16 'webserver.https', 'webserver.host', 'webserver.port', 16 'database.host', 'database.port', 'database.suffix',
17 'database.host', 'database.port', 'database.suffix', 17 'storage.certs', 'storage.uploads', 'storage.logs',
18 'storage.certs', 'storage.uploads', 'storage.logs', 18 'network.friends' ]
19 'network.friends' ] 19 var miss = []
20 var miss = [] 20
21 21 for (var key of required) {
22 for (var key of required) { 22 if (!config.has(key)) {
23 if (!config.has(key)) { 23 miss.push(key)
24 miss.push(key)
25 }
26 } 24 }
27
28 return miss
29 } 25 }
30 26
31 // Create directories for the storage if it doesn't exist 27 return miss
32 function createDirectoriesIfNotExist () { 28}
33 var storages = config.get('storage') 29
34 30// Create directories for the storage if it doesn't exist
35 for (var key of Object.keys(storages)) { 31function createDirectoriesIfNotExist () {
36 var dir = storages[key] 32 var storages = config.get('storage')
37 try { 33
38 mkdirp.sync(path.join(__dirname, '..', dir)) 34 for (var key of Object.keys(storages)) {
39 } catch (error) { 35 var dir = storages[key]
40 // Do not use logger 36 try {
41 console.error('Cannot create ' + path + ':' + error) 37 mkdirp.sync(path.join(__dirname, '..', dir))
42 process.exit(0) 38 } catch (error) {
43 } 39 // Do not use logger
40 console.error('Cannot create ' + path + ':' + error)
41 process.exit(0)
44 } 42 }
45 } 43 }
44}
46 45
47 // --------------------------------------------------------------------------- 46// ---------------------------------------------------------------------------
48 47
49 module.exports = checker 48module.exports = checker
50})()