Remove config groups

Refactor away the config group concept and simplyfy the way config
fields are defined.  Fields are defined directly as properties of the
static field fieldDefinitions on the class itself with a separate
interface to declare the types of fields.

This makes it possible to easily make accessing the config fields type
checked in a way that lets plugins extend the interfaces with their own
config options by adding additional fields to the interface via
declation merging.
This commit is contained in:
Hornwitser committed 2024-01-09 02:19:07 +01:00
1 parent 96210373f3
commit e74065a493
35 files changed
+1259 -2090

No files matched your search

+2 -18
View File
@@ -205,30 +205,14 @@ describe("Integration of Clusterio", function() {
});
it("should not leak auth_secret", async function() {
let result = await getControl().send(new lib.ControllerConfigGetRequest());
let done = false;
for (let group of result.groups) {
if (group.name === "controller") {
assert.equal(Object.prototype.hasOwnProperty.call(group.fields, "auth_secret"), false);
done = true;
break;
}
}
assert(done, "controller group not found");
assert.equal(Object.prototype.hasOwnProperty.call(result, "controller.auth_secret"), false);
});
});
describe("controller config set", function() {
it("sets given config option", async function() {
await execCtl('controller config set controller.name "Test Cluster"');
let result = await getControl().send(new lib.ControllerConfigGetRequest());
let done = false;
for (let group of result.groups) {
if (group.name === "controller") {
assert.equal(group.fields.name, "Test Cluster");
done = true;
break;
}
}
assert(done, "controller group not found");
assert.equal(result["controller.name"], "Test Cluster");
});
it("should not allow setting auth_secret", async function() {
await assert.rejects(execCtl("controller config set controller.auth_secret root"));