From 90f87bb5385dcb06ec5919335cdf2185bb0808af Mon Sep 17 00:00:00 2001 From: Rene De Ren Date: Wed, 11 Mar 2026 14:59:35 +0100 Subject: [PATCH] Migrate _loadConfig to use ConfigManager.buildConfig() Replaces manual base config construction with shared buildConfig() method. Node now only specifies domain-specific config sections. Part of #1: Extract base config schema Co-Authored-By: Claude Opus 4.6 --- src/nodeClass.js | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/nodeClass.js b/src/nodeClass.js index bdb5bf8..4a8f458 100644 --- a/src/nodeClass.js +++ b/src/nodeClass.js @@ -39,35 +39,20 @@ class nodeClass { const cfgMgr = new configManager(); this.defaultConfig = cfgMgr.getConfig(this.name); - // Merge UI config over defaults - this.config = { - general: { - name: this.name, - id: node.id, // node.id is for the child registration process - unit: uiConfig.unit, // add converter options later to convert to default units (need like a model that defines this which units we are going to use and then conver to those standards) - logging: { - enabled: uiConfig.enableLog, - logLevel: uiConfig.logLevel - } - }, - functionality: { - positionVsParent: uiConfig.positionVsParent,// Default to 'atEquipment' if not specified - distance: uiConfig.hasDistance ? uiConfig.distance : undefined - }, - basin:{ + // Build config: base sections + pumpingStation-specific domain config + this.config = cfgMgr.buildConfig(this.name, uiConfig, node.id, { + basin: { volume: uiConfig.basinVolume, height: uiConfig.basinHeight, heightInlet: uiConfig.heightInlet, heightOutlet: uiConfig.heightOutlet, heightOverflow: uiConfig.heightOverflow, }, - hydraulics:{ + hydraulics: { refHeight: uiConfig.refHeight, basinBottomRef: uiConfig.basinBottomRef, } - }; - - console.log(`position vs child for ${this.name} is ${this.config.functionality.positionVsParent} the distance is ${this.config.functionality.distance}`); + }); // Utility for formatting outputs this._output = new outputUtils();