-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.js
More file actions
38 lines (31 loc) · 973 Bytes
/
main.js
File metadata and controls
38 lines (31 loc) · 973 Bytes
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
"use strict";
const Application = require("./lib/Application");
const stage = (process.env["STAGE"] || process.env["NODE_ENV"] || "dev").toLowerCase();
require("events").defaultMaxListeners = 50;
if (stage == "dev") require("dotenv").config();
Application.configure({
rootDir: process.cwd(),
modules_path: process.cwd() + "/modules",
config_path: process.cwd() + "/config",
stage: stage,
logLevelConsole: stage == "dev" ? "debug" : "info",
logLevelFile: stage == "dev" ? "info" : "info",
logLevelRemote: stage == "dev" ? "debug" : "info",
logformat: "DD.MM.YYYY HH:mm:ss",
logDir: process.cwd() + "/logs",
stages: [
"prod",
"dev"
]
});
Application.run();
process.on("SIGINT", () => Application.stop());
process.on("SIGTERM", () => Application.stop());
process.on("exit", () => Application.stop());
process.on("unhandledRejection", (e) => {
console.error(e);
});
process.on("uncaughtException", (e, ee) => {
console.error(ee);
console.error(e);
});