From 3a81cfd94bbf45a25fbb133c8aae9849d4aaf6de Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:05:32 +0000 Subject: [PATCH] Order fromConfig arguments config first Controller.fromConfig and Host.fromConfig now take the config, then the plugin infos, then the logger or connector. Co-Authored-By: Claude Opus 5.5 --- packages/controller/controller.ts | 4 ++-- packages/controller/src/Controller.ts | 4 ++-- packages/host/host.ts | 2 +- packages/host/src/Host.ts | 2 +- test/controller/Controller.js | 4 ++-- test/host/Host.test.js | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/controller/controller.ts b/packages/controller/controller.ts index bc57c1db..3c95468a 100644 --- a/packages/controller/controller.ts +++ b/packages/controller/controller.ts @@ -475,9 +475,9 @@ async function startup() { } controller = await Controller.fromConfig( - clusterLogger, - pluginInfos, controllerConfig, + pluginInfos, + clusterLogger, Boolean(args.canRestart), Boolean(args.recovery), ); diff --git a/packages/controller/src/Controller.ts b/packages/controller/src/Controller.ts index 45a16a00..d0a12720 100644 --- a/packages/controller/src/Controller.ts +++ b/packages/controller/src/Controller.ts @@ -150,9 +150,9 @@ export default class Controller { /** Create a controller with its datastores and mod store loaded from disk */ static async fromConfig( - clusterLogger: winston.Logger, - pluginInfos: lib.PluginNodeEnvInfo[], config: lib.ControllerConfig, + pluginInfos: lib.PluginNodeEnvInfo[], + clusterLogger: winston.Logger, canRestart = false, recoveryMode = false, ) { diff --git a/packages/host/host.ts b/packages/host/host.ts index 566232ca..db2a9357 100755 --- a/packages/host/host.ts +++ b/packages/host/host.ts @@ -234,9 +234,9 @@ async function startHost() { let hostConnector = new HostConnector(hostConfig, pluginInfos); host = await Host.fromConfig( - hostConnector, hostConfig, pluginInfos, + hostConnector, Boolean(args.canRestart), Boolean(args.recovery), ); diff --git a/packages/host/src/Host.ts b/packages/host/src/Host.ts index 8d89c75a..c90b0c5e 100644 --- a/packages/host/src/Host.ts +++ b/packages/host/src/Host.ts @@ -331,9 +331,9 @@ export default class Host extends lib.Link { /** Create a host with its mod store loaded from disk */ static async fromConfig( - connector: HostConnector, hostConfig: lib.HostConfig, pluginInfos: lib.PluginNodeEnvInfo[], + connector: HostConnector, canRestart = false, recoveryMode = false, ) { diff --git a/test/controller/Controller.js b/test/controller/Controller.js index 8a8b5edf..35a0cf4b 100644 --- a/test/controller/Controller.js +++ b/test/controller/Controller.js @@ -79,7 +79,7 @@ describe("controller/src/Controller", function() { "controller.mods_directory": modsDirectory, }); - const loaded = await Controller.fromConfig({}, [], config, true, false); + const loaded = await Controller.fromConfig(config, [], {}, true, false); assert(loaded instanceof Controller); assert.equal(loaded.canRestart, true); assert.equal(loaded.recoveryMode, false); @@ -122,7 +122,7 @@ describe("controller/src/Controller", function() { "controller.mods_directory": path.join(dir, "mods"), }); - const loaded = await Controller.fromConfig({}, [], config); + const loaded = await Controller.fromConfig(config, [], {}); await loaded.instances.records.save(); const [saved] = JSON.parse(await fs.readFile(instancesPath, "utf8")); assert.equal(saved.config["from_config_plugin.version"], "1.2.0"); diff --git a/test/host/Host.test.js b/test/host/Host.test.js index 9bcfb32c..c8a96a8f 100644 --- a/test/host/Host.test.js +++ b/test/host/Host.test.js @@ -69,7 +69,7 @@ describe("host/src/Host", function() { }); it("should create the mods directory and load the mod store", async function() { const hostConfig = new lib.HostConfig("host", { "host.mods_directory": modsDirectory }); - const host = await Host.fromConfig(new HostConnector(hostConfig, []), hostConfig, [], true, false); + const host = await Host.fromConfig(hostConfig, [], new HostConnector(hostConfig, []), true, false); assert(host instanceof Host); assert.equal(host.canRestart, true); assert.equal(host.recoveryMode, false);