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 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-24 00:05:32 +00:00
1 parent ee097bfa6f
commit 3a81cfd94b
6 files changed
+9 -9

No files matched your search

+2 -2
View File
@@ -475,9 +475,9 @@ async function startup() {
} }
controller = await Controller.fromConfig( controller = await Controller.fromConfig(
clusterLogger,
pluginInfos,
controllerConfig, controllerConfig,
pluginInfos,
clusterLogger,
Boolean(args.canRestart), Boolean(args.canRestart),
Boolean(args.recovery), Boolean(args.recovery),
); );
+2 -2
View File
@@ -150,9 +150,9 @@ export default class Controller {
/** Create a controller with its datastores and mod store loaded from disk */ /** Create a controller with its datastores and mod store loaded from disk */
static async fromConfig( static async fromConfig(
clusterLogger: winston.Logger,
pluginInfos: lib.PluginNodeEnvInfo[],
config: lib.ControllerConfig, config: lib.ControllerConfig,
pluginInfos: lib.PluginNodeEnvInfo[],
clusterLogger: winston.Logger,
canRestart = false, canRestart = false,
recoveryMode = false, recoveryMode = false,
) { ) {
+1 -1
View File
@@ -234,9 +234,9 @@ async function startHost() {
let hostConnector = new HostConnector(hostConfig, pluginInfos); let hostConnector = new HostConnector(hostConfig, pluginInfos);
host = await Host.fromConfig( host = await Host.fromConfig(
hostConnector,
hostConfig, hostConfig,
pluginInfos, pluginInfos,
hostConnector,
Boolean(args.canRestart), Boolean(args.canRestart),
Boolean(args.recovery), Boolean(args.recovery),
); );
+1 -1
View File
@@ -331,9 +331,9 @@ export default class Host extends lib.Link {
/** Create a host with its mod store loaded from disk */ /** Create a host with its mod store loaded from disk */
static async fromConfig( static async fromConfig(
connector: HostConnector,
hostConfig: lib.HostConfig, hostConfig: lib.HostConfig,
pluginInfos: lib.PluginNodeEnvInfo[], pluginInfos: lib.PluginNodeEnvInfo[],
connector: HostConnector,
canRestart = false, canRestart = false,
recoveryMode = false, recoveryMode = false,
) { ) {
+2 -2
View File
@@ -79,7 +79,7 @@ describe("controller/src/Controller", function() {
"controller.mods_directory": modsDirectory, "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(loaded instanceof Controller);
assert.equal(loaded.canRestart, true); assert.equal(loaded.canRestart, true);
assert.equal(loaded.recoveryMode, false); assert.equal(loaded.recoveryMode, false);
@@ -122,7 +122,7 @@ describe("controller/src/Controller", function() {
"controller.mods_directory": path.join(dir, "mods"), "controller.mods_directory": path.join(dir, "mods"),
}); });
const loaded = await Controller.fromConfig({}, [], config); const loaded = await Controller.fromConfig(config, [], {});
await loaded.instances.records.save(); await loaded.instances.records.save();
const [saved] = JSON.parse(await fs.readFile(instancesPath, "utf8")); const [saved] = JSON.parse(await fs.readFile(instancesPath, "utf8"));
assert.equal(saved.config["from_config_plugin.version"], "1.2.0"); assert.equal(saved.config["from_config_plugin.version"], "1.2.0");
+1 -1
View File
@@ -69,7 +69,7 @@ describe("host/src/Host", function() {
}); });
it("should create the mods directory and load the mod store", async 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 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(host instanceof Host);
assert.equal(host.canRestart, true); assert.equal(host.canRestart, true);
assert.equal(host.recoveryMode, false); assert.equal(host.recoveryMode, false);