diff --git a/README.md b/README.md index d5b18647..30475ac1 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ SpaceNinjaServer requires a `config.json`. To set it up, you can copy the [confi - `skipTutorial` affects only newly created accounts, so you may wish to change it before logging in for the first time. - `logger.level` can be `fatal`, `error`, `warn`, `info`, `http`, `debug`, or `trace`. -- `ircAddress`, `hubAddress`, and `nrsAddress` are not present by default but can be provided if these secondary servers are on a different machine. +- `ircExecutable` can be provided with a relative path to an EXE which will be ran as a child process of SpaceNinjaServer. +- `ircAddress`, `hubAddress`, and `nrsAddress` can be provided if these secondary servers are on a different machine. - `worldState.eidolonOverride` can be set to `day` or `night` to lock the time to day/fass and night/vome on Plains of Eidolon/Cambion Drift. - `worldState.vallisOverride` can be set to `warm` or `cold` to lock the temperature on Orb Vallis. - `worldState.duviriOverride` can be set to `joy`, `anger`, `envy`, `sorrow`, or `fear` to lock the Duviri spiral. diff --git a/config-vanilla.json b/config-vanilla.json index d7c21458..0c9e1d52 100644 --- a/config-vanilla.json +++ b/config-vanilla.json @@ -8,6 +8,10 @@ "bindAddress": "0.0.0.0", "httpPort": 80, "httpsPort": 443, + "ircExecutable": null, + "ircAddress": null, + "hubAddress": null, + "nrsAddress": null, "administratorNames": [], "autoCreateAccount": true, "skipTutorial": false, diff --git a/src/index.ts b/src/index.ts index 3021b14b..a4e2a8c7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,7 @@ logger.info("Starting up..."); // Proceed with normal startup: bring up config watcher service, validate config, connect to MongoDB, and finally start listening for HTTP. import mongoose from "mongoose"; import path from "path"; +import child_process from "child_process"; import { JSONStringify } from "json-with-bigint"; import { startWebServer } from "./services/webService.ts"; import { validateConfig } from "./services/configWatcherService.ts"; @@ -43,6 +44,17 @@ mongoose startWebServer(); + if (config.ircExecutable) { + logger.info(`Starting IRC server: ${config.ircExecutable}`); + child_process.execFile(config.ircExecutable, (error, _stdout, _stderr) => { + if (error) { + logger.warn(`Failed to start IRC server`, error); + } else { + logger.warn(`IRC server terminated unexpectedly`); + } + }); + } + void updateWorldStateCollections(); setInterval(() => { void updateWorldStateCollections(); diff --git a/src/services/configService.ts b/src/services/configService.ts index db58354e..112f0b01 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -15,6 +15,7 @@ export interface IConfig { bindAddress?: string; httpPort?: number; httpsPort?: number; + ircExecutable?: string; ircAddress?: string; hubAddress?: string; nrsAddress?: string;