-
Notifications
You must be signed in to change notification settings - Fork 12
/
server.js
43 lines (36 loc) · 912 Bytes
/
server.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
42
43
const { argv } = require("yargs");
const datastore = require("./src/datastore");
const nucleoid = require("./");
const cluster = require("./src/cluster");
const chalk = require("chalk");
const log = console.log;
if (!argv.debug) {
console.debug = () => {};
}
if (argv.silence) {
console.log = () => {};
console.info = () => {};
console.warn = () => {};
console.error = () => {};
console.debug = () => {};
}
if (argv.clear) {
datastore.clear();
}
nucleoid.start().then(() => {
if (argv.silence) {
log("Nucleoid runtime is started");
}
const { id, port } = require("./src/config")();
console.log("");
console.log("---");
console.log("Terminal: " + chalk.blue(`http://localhost:${port.terminal}`));
console.log(
"IDE: " +
chalk.blue(`https://nucleoid.com/ide/${id}/query?mode=terminal`)
);
console.log("");
if (argv.cluster) {
cluster.init();
}
});