-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
34 lines (26 loc) · 1.02 KB
/
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
28
29
30
31
32
33
34
"use strict";
const chalk = require("chalk");
const logger = require("./clank-rest/logger.js");
const server = require("./clank-rest/rest_server.js");
const rpc = require("./clank-rest/rpc_client.js");
global.name = "clank-rest";
global.version = "0.1.0";
require('./clank-rest/utils.js')();
let logo = [
"_|_|_| _| _|_| _| _| _| _|",
"_| _| _| _| _|_| _| _| _|",
"_| _| _|_|_|_| _| _| _| _|_|",
"_| _| _| _| _| _|_| _| _|",
"_|_|_| _|_|_|_| _| _| _| _| _| _| REST API Bridge ~ v{0}".format(global.version)
];
console.log(chalk["cyan"].bold(logo.join("\n")) + "\n");
global.logger = logger;
try {
global.config = require("./config.json");
} catch (err) {
console.error("Invalid config.json file or does not exist: {0}".format(err));
process.exit(-1);
}
logger.setLogLevel(global.config.log_level);
logger.log("info", "Starting {0} v{1} ...".format(global.name, global.version));
server.start(global.config.host, global.config.port);