-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.js
More file actions
58 lines (34 loc) · 1.24 KB
/
setup.js
File metadata and controls
58 lines (34 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict'
var db_manager = require('./sql/db-manager');
var init = require('./src/server');
var config = require('./config/config');
console.log("* app_stream setup activated\n");
if (config.db_setup == 'true') {
db_manager().then(function (status) {
if (status == "OK") {
console.log("\n * db_manager successfully sets up db\n");
console.log(" * server is being activated with configs: \n");
console.log(config);
console.log("\n");
init();
console.log('\n ** good job, system is ready and fully functional! \n');
}
}).catch(function (err) {
console.log("Sorry, an err occurred during db set up. check the corresponding err message for more info");
console.log(err);
});
} else {
console.log("\n * db_manager not activated\n");
console.log(" * proceeding to activate server with configs: \n");
console.log(config);
console.log("\n");
init();
console.log('\n ** good job, system is ready and fully functional! \n');
}
//handle uncauth errors - when the Steem API goes down
process.on('unhandledRejection', (reason, promise) => {
console.log('Unhandled Rejection at:', reason.stack || reason)
console.log(' ** re-activating the server');
// log crash if you want
init();
})