Skip to content

Port option from device.yml Not Being Applied #312

@felix-reck

Description

@felix-reck

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

  • FlowFuse version: Flowfuse Cloud
  • Node.js version: 20.17.0
  • npm version: 10.8.2
  • Platform/OS: Windows Server 2022
  • Browser: Edge

Linked Customers

No response

Metadata

Metadata

Assignees

Labels

area:deviceDevice specific workbugSomething isn't workingsize:XS - 1Sizing estimation point

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions