feat: ircExecutable config (#2945)

Reviewed-on: OpenWF/SpaceNinjaServer#2945
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-10-28 00:50:55 -07:00 committed by Sainan
parent bb1d6a98c5
commit e3048ea188
4 changed files with 19 additions and 1 deletions

View File

@ -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.

View File

@ -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,

View File

@ -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();

View File

@ -15,6 +15,7 @@ export interface IConfig {
bindAddress?: string;
httpPort?: number;
httpsPort?: number;
ircExecutable?: string;
ircAddress?: string;
hubAddress?: string;
nrsAddress?: string;