Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port option from device.yml Not Being Applied #312

Closed
felix-reck opened this issue Sep 3, 2024 · 0 comments · Fixed by #313
Closed

Port option from device.yml Not Being Applied #312

felix-reck opened this issue Sep 3, 2024 · 0 comments · Fixed by #313
Assignees
Labels
area:device Device specific work bug Something isn't working size:XS - 1 Sizing estimation point
Milestone

Comments

@felix-reck
Copy link

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

@felix-reck felix-reck added the needs-triage Needs looking at to decide what to do label Sep 3, 2024
@knolleary knolleary moved this to Todo in 🛠 Development Sep 3, 2024
@knolleary knolleary added this to the 2.9 milestone Sep 3, 2024
@knolleary knolleary added bug Something isn't working area:device Device specific work size:XS - 1 Sizing estimation point and removed needs-triage Needs looking at to decide what to do labels Sep 3, 2024
@hardillb hardillb self-assigned this Sep 3, 2024
@hardillb hardillb mentioned this issue Sep 3, 2024
10 tasks
@github-project-automation github-project-automation bot moved this from Review to Done in 🛠 Development Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:device Device specific work bug Something isn't working size:XS - 1 Sizing estimation point
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants