-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
27 lines (25 loc) · 990 Bytes
/
index.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
const cluster = require('cluster');
const ConfigLoader = require('cytube-common/lib/configuration/configloader');
const FrontendConfiguration = require('./lib/configuration/frontendconfig')['default'];
const logger = require('cytube-common/lib/logger')['default'];
const path = require('path');
require('source-map-support').install();
var frontendConfig;
try {
frontendConfig = ConfigLoader.loadFromToml(FrontendConfiguration,
path.resolve(__dirname, 'frontend.toml'));
} catch (error) {
if (typeof error.line !== undefined) {
logger.error(`Error in configuration file: ${error} (line ${error.line})`);
} else {
logger.error('Error loading configuration: ' + error);
}
process.exit(1);
}
if (cluster.isMaster) {
const Master = require('./lib/cluster/master')['default'];
new Master(frontendConfig).initialize();
} else {
const Worker = require('./lib/cluster/worker')['default'];
new Worker(frontendConfig).initialize();
}