mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
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:
1 parent
96210373f3
commit
e74065a493
35 files changed
+1259
-2090
No files matched your search
@@ -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"));
|
||||
|
||||
Reference in new issue
Block a user