forked from hull-ships/hull-processor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
42 lines (32 loc) · 1.15 KB
/
index.js
File metadata and controls
42 lines (32 loc) · 1.15 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
import Hull from "hull";
import server from "./server";
if (process.env.NEW_RELIC_LICENSE_KEY) {
console.warn("Starting newrelic agent with key: ", process.env.NEW_RELIC_LICENSE_KEY);
require("newrelic"); // eslint-disable-line global-require
}
if (process.env.LOG_LEVEL) {
Hull.logger.transports.console.level = process.env.LOG_LEVEL;
}
Hull.logger.transports.console.json = true;
if (process.env.LOGSTASH_HOST && process.env.LOGSTASH_HOST) {
const Logstash = require("winston-logstash").Logstash; // eslint-disable-line global-require
Hull.logger.add(Logstash, {
node_name: "processor",
port: process.env.LOGSTASH_PORT,
host: process.env.LOGSTASH_HOST
});
}
// https://www.npmjs.com/package/express-winston
Hull.logger.debug("processor.boot");
const options = {
hostSecret: process.env.SECRET || "1234",
devMode: process.env.NODE_ENV === "development",
port: process.env.PORT || 8082,
clientConfig: {
firehoseUrl: process.env.OVERRIDE_FIREHOSE_URL
}
};
const connector = new Hull.Connector(options);
const app = server(connector, options);
connector.startApp(app);
Hull.logger.debug("processor.started", { port: options.port });