diff options
Diffstat (limited to 'src/checker.js')
-rw-r--r-- | src/checker.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/checker.js b/src/checker.js deleted file mode 100644 index 7a3a53616..000000000 --- a/src/checker.js +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | ;(function () { | ||
2 | 'use strict' | ||
3 | |||
4 | var config = require('config') | ||
5 | var mkdirp = require('mkdirp') | ||
6 | |||
7 | var checker = {} | ||
8 | |||
9 | // Check the config files | ||
10 | checker.checkConfig = function () { | ||
11 | var required = [ 'listen.port', | ||
12 | 'webserver.https', 'webserver.host', 'webserver.port', | ||
13 | 'database.host', 'database.port', 'database.suffix', | ||
14 | 'storage.certs', 'storage.uploads', 'storage.logs', | ||
15 | 'network.friends' ] | ||
16 | var miss = [] | ||
17 | |||
18 | for (var key of required) { | ||
19 | if (!config.has(key)) { | ||
20 | miss.push(key) | ||
21 | } | ||
22 | } | ||
23 | |||
24 | return miss | ||
25 | } | ||
26 | |||
27 | // Create directories for the storage if it doesn't exist | ||
28 | checker.createDirectoriesIfNotExist = function () { | ||
29 | var storages = config.get('storage') | ||
30 | |||
31 | for (var key of Object.keys(storages)) { | ||
32 | var path = storages[key] | ||
33 | try { | ||
34 | mkdirp.sync(__dirname + '/../' + path) | ||
35 | } catch (error) { | ||
36 | // Do not use logger | ||
37 | console.error('Cannot create ' + path + ':' + error) | ||
38 | process.exit(0) | ||
39 | } | ||
40 | } | ||
41 | } | ||
42 | |||
43 | // ----------- Export ----------- | ||
44 | module.exports = checker | ||
45 | })() | ||