Refactor config to JSON data class pattern

Refactor the Config and ConfigGroup classes to match the JSON data class
pattern with toJSON, toRemote and fromJSON methods replacing the load,
init, and serialize methods.  Since fromJSON requires extra information
the messages structures passes around the plain JSON representation of
the configs instead of serialising instances of the config classes
automatically.
This commit is contained in:
Hornwitser committed 2024-01-06 19:53:32 +01:00
1 parent 27af142a87
commit 001db4befe
24 files changed
+269 -334

No files matched your search

+2 -2
View File
@@ -206,7 +206,7 @@ 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.serializedConfig.groups) {
for (let group of result.groups) {
if (group.name === "controller") {
assert.equal(Object.prototype.hasOwnProperty.call(group.fields, "auth_secret"), false);
done = true;
@@ -221,7 +221,7 @@ describe("Integration of Clusterio", 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.serializedConfig.groups) {
for (let group of result.groups) {
if (group.name === "controller") {
assert.equal(group.fields.name, "Test Cluster");
done = true;