Merge pull request #1049 from ColumbusLabs/fix/796-config-editor-field-names

Fix CLI config editor field names
This commit is contained in:
Cooldude2606 authored and GitHub committed 2026-10-07 20:01:18 +01:00
commit c3337bdedb
4 files changed
+24 -3

No files matched your search

+1 -1
View File
@@ -219,7 +219,7 @@ hostConfigCommands.add(new lib.Command({
let editor = await getEditor(args.editor);
if (editor === undefined) {
throw new lib.CommandError(`No editor avalible. Checked CLI input, EDITOR and VISUAL env vars
Try "ctl controller config edit <editor of choice>"`);
Try "ctl host config edit <editor of choice>"`);
}
let disallowedList = {"host.id": 0};
let allConfigElements = serializedConfigToString(
+1 -1
View File
@@ -156,7 +156,7 @@ instanceConfigCommands.add(new lib.Command({
let editor = await getEditor(args.editor);
if (editor === undefined) {
throw new lib.CommandError(`No editor avalible. Checked CLI input, EDITOR and VISUAL env vars
Try "ctl controller config edit <editor of choice>"`);
Try "ctl instance config edit <editor of choice>"`);
}
let disallowedList = {"instance.id": 0, "instance.assigned_host": 0, "factorio.settings": 0};
let allConfigElements = serializedConfigToString(
+1 -1
View File
@@ -16,7 +16,7 @@ export async function configToKeyVal(data: string) {
for (let index in filtered) {
if (index in filtered) {
let split = filtered[index].split("=");
let finalIndex = filtered[index][0].trim();
let finalIndex = split[0].trim();
// split on the = we added earlier, giving us both value and key
let part = "";
try {
+21
View File
@@ -0,0 +1,21 @@
import assert from "node:assert/strict";
import { configToKeyVal } from "@clusterio/ctl/dist/node/src/config_ops.js";
describe("ctl/config_ops", function() {
it("preserves full field names with LF and CRLF input", async function() {
for (let newline of ["\n", "\r\n"]) {
const data = [
"# Clusterio configuration",
"",
"instance.name = Example",
"inventory_sync.load_plugin = false",
"",
].join(newline);
assert.deepEqual(await configToKeyVal(data), {
"instance.name": "Example",
"inventory_sync.load_plugin": "false",
});
}
});
});