aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2020-01-05 16:06:25 -0800
committerSam Wilkins <samwilkins333@gmail.com>2020-01-05 16:06:25 -0800
commitc59e2abab0dceba6cc06f99e871f11be963293ae (patch)
tree28d4b279707f1dcbee3cece69d88cb8d37efd1f4
parent8d50b63be5dd754d9260adbf69323f3ac2b8cb08 (diff)
allow regular dev use
-rw-r--r--src/server/index.ts64
1 files changed, 35 insertions, 29 deletions
diff --git a/src/server/index.ts b/src/server/index.ts
index 3dc0c739e..18b31e7a4 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -130,34 +130,40 @@ function routeSetter({ isRelease, addSupervisedRoute, logRegistrationOutcome }:
WebSocket.start(isRelease);
}
-/**
+async function launchServer() {
+ await log_execution({
+ startMessage: "\nstarting execution of preliminary functions",
+ endMessage: "completed preliminary functions\n",
+ action: preliminaryFunctions
+ });
+ await initializeServer(routeSetter);
+}
+
+if (process.env.RELEASE) {
+ /**
* Thread dependent session initialization
*/
-(async function launch() {
- if (isMaster) {
- const emailGenerator = (error: Error) => {
- const subject = "Dash Web Server Crash";
- const { name, message, stack } = error;
- const body = [
- "You, as a Dash Administrator, are being notified of a server crash event. Here's what we know:",
- `name:\n${name}`,
- `message:\n${message}`,
- `stack:\n${stack}`,
- "The server is already restarting itself, but if you're concerned, use the Remote Desktop Connection to monitor progress.",
- ].join("\n\n");
- return { subject, body };
- };
- const customizer = await Session.initializeMonitorThread(emailGenerator);
- customizer.addReplCommand("pull", [], () => execSync("git pull", { stdio: ["ignore", "inherit", "inherit"] }));
- } else {
- const addExitHandler = await Session.initializeWorkerThread(async () => {
- await log_execution({
- startMessage: "\nstarting execution of preliminary functions",
- endMessage: "completed preliminary functions\n",
- action: preliminaryFunctions
- });
- await initializeServer(routeSetter);
- });
- addExitHandler(() => Utils.Emit(WebSocket._socket, MessageStore.ConnectionTerminated, "Manual"));
- }
-})(); \ No newline at end of file
+ (async function launchSession() {
+ if (isMaster) {
+ const emailGenerator = (error: Error) => {
+ const subject = "Dash Web Server Crash";
+ const { name, message, stack } = error;
+ const body = [
+ "You, as a Dash Administrator, are being notified of a server crash event. Here's what we know:",
+ `name:\n${name}`,
+ `message:\n${message}`,
+ `stack:\n${stack}`,
+ "The server is already restarting itself, but if you're concerned, use the Remote Desktop Connection to monitor progress.",
+ ].join("\n\n");
+ return { subject, body };
+ };
+ const customizer = await Session.initializeMonitorThread(emailGenerator);
+ customizer.addReplCommand("pull", [], () => execSync("git pull", { stdio: ["ignore", "inherit", "inherit"] }));
+ } else {
+ const addExitHandler = await Session.initializeWorkerThread(launchServer);
+ addExitHandler(() => Utils.Emit(WebSocket._socket, MessageStore.ConnectionTerminated, "Manual"));
+ }
+ })();
+} else {
+ launchServer();
+} \ No newline at end of file