TypeScript!
This commit is contained in:
1 parent
ee8c43747e
commit
5d3c81cb23
105 files changed
+12054
-1901
No files matched your search
+9
-11
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env -S node -r esm
|
||||
"use strict";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
#!/usr/bin/env -S node -r esm -r ts-node/register/transpile-only
|
||||
import * as path from "path";
|
||||
import * as fs from "fs";
|
||||
|
||||
process.chdir(path.resolve(path.dirname(fs.realpathSync(__filename)), ".."));
|
||||
|
||||
@@ -13,7 +12,6 @@ import * as cwmp from "../lib/cwmp";
|
||||
import * as db from "../lib/db";
|
||||
import * as extensions from "../lib/extensions";
|
||||
import * as cache from "../lib/cache";
|
||||
|
||||
import { version as VERSION } from "../package.json";
|
||||
|
||||
logger.init("cwmp", VERSION);
|
||||
@@ -21,14 +19,14 @@ logger.init("cwmp", VERSION);
|
||||
const SERVICE_ADDRESS = config.get("CWMP_INTERFACE");
|
||||
const SERVICE_PORT = config.get("CWMP_PORT");
|
||||
|
||||
function exitWorkerGracefully() {
|
||||
function exitWorkerGracefully(): void {
|
||||
db.disconnect();
|
||||
cache.disconnect();
|
||||
extensions.killAll();
|
||||
cluster.worker.disconnect();
|
||||
}
|
||||
|
||||
function exitWorkerUngracefully() {
|
||||
function exitWorkerUngracefully(): void {
|
||||
extensions.killAll(() => {
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -66,14 +64,14 @@ if (!cluster.worker) {
|
||||
let ssl;
|
||||
if (config.get("CWMP_SSL")) {
|
||||
ssl = {
|
||||
key: path.resolve(config.get("CONFIG_DIR"), "cwmp.key"),
|
||||
cert: path.resolve(config.get("CONFIG_DIR"), "cwmp.crt"),
|
||||
ca: path.resolve(config.get("CONFIG_DIR"), "cwmp.ca-bundle")
|
||||
key: path.resolve("" + config.get("CONFIG_DIR"), "cwmp.key"),
|
||||
cert: path.resolve("" + config.get("CONFIG_DIR"), "cwmp.crt"),
|
||||
ca: path.resolve("" + config.get("CONFIG_DIR"), "cwmp.ca-bundle")
|
||||
};
|
||||
}
|
||||
|
||||
process.on("uncaughtException", err => {
|
||||
if (err.code === "ERR_IPC_DISCONNECTED") return;
|
||||
if ((err as NodeJS.ErrnoException).code === "ERR_IPC_DISCONNECTED") return;
|
||||
logger.error({
|
||||
message: "Uncaught exception",
|
||||
exception: err,
|
||||
|
||||
Reference in new issue
Block a user