Problem: Changing the port via the device.yml file is not working.
Cause: In the config function within device-agent/lib/config.js, the return value is constructed by merging parsedOptions.deviceConfig and options using the spread operator.
Since options always includes the default port 1880 (from device-agent/lib/cli/args.js), even without the -p argument, the port setting from parsedOptions.deviceConfig is never applied because the last spread operator takes precedence.
Possible Solution: To fix this issue, ensure that parsedOptions.deviceConfig takes precedence over options by adjusting the order in which the spread operator is applied.
Current Behavior
Problem: Changing the port via the device.yml file is not working.
Cause: In the config function within device-agent/lib/config.js, the return value is constructed by merging parsedOptions.deviceConfig and options using the spread operator.
Since options always includes the default port 1880 (from device-agent/lib/cli/args.js), even without the -p argument, the port setting from parsedOptions.deviceConfig is never applied because the last spread operator takes precedence.
Possible Solution: To fix this issue, ensure that parsedOptions.deviceConfig takes precedence over options by adjusting the order in which the spread operator is applied.
changing this:
return { version, ...parsedOptions.deviceConfig, ...options }
to this:return { version, ...options, ...parsedOptions.deviceConfig }
makes the port setting in device.yml the priority setting
Expected Behavior
Adding port option to device.yml should change the port
Steps To Reproduce
Add port to device.yml for example 2222 start device agent without port command-line argument 🠊 node-RED still runs at 1880
Environment
Linked Customers
No response