Make config file optional

This commit is contained in:
Zaid Abdulla committed 2019-06-05 00:17:36 -07:00
1 parent e7821f655b
commit faa12537e4
9 files changed
+126 -87

No files matched your search

+4 -13
View File
@@ -1,9 +1,4 @@
#!/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)), ".."));
import * as config from "../lib/config";
import * as logger from "../lib/logger";
import * as cluster from "../lib/cluster";
@@ -61,14 +56,10 @@ if (!cluster.worker) {
cluster.stop();
});
} else {
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")
};
}
const ssl = {
key: config.get("CWMP_SSL_KEY"),
cert: config.get("CWMP_SSL_CERT")
};
process.on("uncaughtException", err => {
if ((err as NodeJS.ErrnoException).code === "ERR_IPC_DISCONNECTED") return;
+1 -1
View File
@@ -69,7 +69,7 @@ process.on("message", message => {
jobs.add(message[0]);
if (!script) {
const cwd = process.env["GENIEACS_CONFIG_DIR"] + "/ext";
const cwd = process.env["GENIEACS_EXT_DIR"];
process.chdir(cwd);
script = require(`${cwd}/${fileName}`);
}
+4 -13
View File
@@ -1,9 +1,4 @@
#!/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)), ".."));
import * as config from "../lib/config";
import * as logger from "../lib/logger";
import * as cluster from "../lib/cluster";
@@ -57,14 +52,10 @@ if (!cluster.worker) {
cluster.stop();
});
} else {
let ssl;
if (config.get("FS_SSL")) {
ssl = {
key: path.resolve("" + config.get("CONFIG_DIR"), "fs.key"),
cert: path.resolve("" + config.get("CONFIG_DIR"), "fs.crt"),
ca: path.resolve("" + config.get("CONFIG_DIR"), "fs.ca-bundle")
};
}
const ssl = {
key: config.get("FS_SSL_KEY"),
cert: config.get("FS_SSL_CERT")
};
process.on("uncaughtException", err => {
if ((err as NodeJS.ErrnoException).code === "ERR_IPC_DISCONNECTED") return;
+4 -13
View File
@@ -1,9 +1,4 @@
#!/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)), ".."));
import * as config from "../lib/config";
import * as logger from "../lib/logger";
import * as cluster from "../lib/cluster";
@@ -61,14 +56,10 @@ if (!cluster.worker) {
cluster.stop();
});
} else {
let ssl;
if (config.get("NBI_SSL")) {
ssl = {
key: path.resolve("" + config.get("CONFIG_DIR"), "nbi.key"),
cert: path.resolve("" + config.get("CONFIG_DIR"), "nbi.crt"),
ca: path.resolve("" + config.get("CONFIG_DIR"), "nbi.ca-bundle")
};
}
const ssl = {
key: config.get("NBI_SSL_KEY"),
cert: config.get("NBI_SSL_CERT")
};
process.on("uncaughtException", err => {
if ((err as NodeJS.ErrnoException).code === "ERR_IPC_DISCONNECTED") return;
+4 -13
View File
@@ -1,9 +1,4 @@
#!/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)), ".."));
import * as config from "../lib/config";
import * as logger from "../lib/logger";
import * as cluster from "../lib/cluster";
@@ -63,14 +58,10 @@ if (!cluster.worker) {
cluster.stop();
});
} else {
let ssl;
if (config.get("UI_SSL")) {
ssl = {
key: path.resolve("" + config.get("CONFIG_DIR"), "ui.key"),
cert: path.resolve("" + config.get("CONFIG_DIR"), "ui.crt"),
ca: path.resolve("" + config.get("CONFIG_DIR"), "ui.ca-bundle")
};
}
const ssl = {
key: config.get("UI_SSL_KEY"),
cert: config.get("UI_SSL_CERT")
};
let stopping = false;