XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

feat: ircExecutable config (#2945)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2945 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

e3048ea1
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

4 个文件 +19 -1
Modified README.md +2 -1
@@ -14,7 +14,8 @@ SpaceNinjaServer requires a `config.json`. To set it up, you can copy the [confi
14 14
15 15 - `skipTutorial` affects only newly created accounts, so you may wish to change it before logging in for the first time.
16 16 - `logger.level` can be `fatal`, `error`, `warn`, `info`, `http`, `debug`, or `trace`.
17 - `ircAddress`, `hubAddress`, and `nrsAddress` are not present by default but can be provided if these secondary servers are on a different machine.
17 - `ircExecutable` can be provided with a relative path to an EXE which will be ran as a child process of SpaceNinjaServer.
18 - `ircAddress`, `hubAddress`, and `nrsAddress` can be provided if these secondary servers are on a different machine.
18 19 - `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.
19 20 - `worldState.vallisOverride` can be set to `warm` or `cold` to lock the temperature on Orb Vallis.
20 21 - `worldState.duviriOverride` can be set to `joy`, `anger`, `envy`, `sorrow`, or `fear` to lock the Duviri spiral.
Modified config-vanilla.json +4 -0
@@ -8,6 +8,10 @@
8 8 "bindAddress": "0.0.0.0",
9 9 "httpPort": 80,
10 10 "httpsPort": 443,
11 "ircExecutable": null,
12 "ircAddress": null,
13 "hubAddress": null,
14 "nrsAddress": null,
11 15 "administratorNames": [],
12 16 "autoCreateAccount": true,
13 17 "skipTutorial": false,
Modified src/index.ts +12 -0
@@ -19,6 +19,7 @@ logger.info("Starting up...");
19 19 // Proceed with normal startup: bring up config watcher service, validate config, connect to MongoDB, and finally start listening for HTTP.
20 20 import mongoose from "mongoose";
21 21 import path from "path";
22 import child_process from "child_process";
22 23 import { JSONStringify } from "json-with-bigint";
23 24 import { startWebServer } from "./services/webService.ts";
24 25 import { validateConfig } from "./services/configWatcherService.ts";
@@ -43,6 +44,17 @@ mongoose
43 44
44 45 startWebServer();
45 46
47 if (config.ircExecutable) {
48 logger.info(`Starting IRC server: ${config.ircExecutable}`);
49 child_process.execFile(config.ircExecutable, (error, _stdout, _stderr) => {
50 if (error) {
51 logger.warn(`Failed to start IRC server`, error);
52 } else {
53 logger.warn(`IRC server terminated unexpectedly`);
54 }
55 });
56 }
57
46 58 void updateWorldStateCollections();
47 59 setInterval(() => {
48 60 void updateWorldStateCollections();
Modified src/services/configService.ts +1 -0
@@ -15,6 +15,7 @@ export interface IConfig {
15 15 bindAddress?: string;
16 16 httpPort?: number;
17 17 httpsPort?: number;
18 ircExecutable?: string;
18 19 ircAddress?: string;
19 20 hubAddress?: string;
20 21 nrsAddress?: string;