-
Notifications
You must be signed in to change notification settings - Fork 11
/
run.js
41 lines (37 loc) · 1.29 KB
/
run.js
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
/*jslint node: true */
"use strict";
const eventBus = require('ocore/event_bus.js');
const desktopApp = require('ocore/desktop_app.js');
const network = require('ocore/network.js');
const conf = require('ocore/conf.js');
const operator = require('aabot/operator.js');
const db_import = require('./db_import.js');
const transfers = require('./transfers.js');
const webserver = require('./webserver.js');
const chat = require('./chat.js');
const stats = require('./stats.js');
const { isRateLimitError } = require('./utils.js');
eventBus.on('headless_wallet_ready', async () => {
await db_import.initDB();
await operator.start();
chat.start();
if (!conf.export_factory_aas || !conf.import_factory_aas)
throw Error("Please specify export and import factory AAs in conf.json");
if (!conf.admin_email || !conf.from_email) {
console.log("please specify admin_email and from_email in your " + desktopApp.getAppDataDir() + "/conf.json");
process.exit(1);
}
// network.start();
await transfers.start();
if (conf.webPort)
webserver.start();
if (conf.bTrackStats)
stats.start();
});
process.on('unhandledRejection', up => {
console.error('unhandledRejection event', up, up.stack);
const errMsg = up.toString();
if (isRateLimitError(errMsg))
return console.error("ignored unhandledRejection");
throw up;
});