Arduino Port is not read from the provided configuration file, uses hardcoded default /dev/ttyACM0
Summary
The configuration file is not read, and only hardcoded default values are used. This renders the application unusable in different customer environments.
Steps to reproduce
╰─ cat config/observability_sensor.conf | grep arduino ─╯
#arduino_port=/dev/ttyACM0
arduino_port=/dev/cu.usbmodem2101
enable_arduino_temp=1
╰─ ./build/observability_sensor ./config/observability_sensor.conf ─╯
Starting ObservabilitySensor Application...
libc++abi: terminating due to uncaught exception of type std::runtime_error: Failed to initialize Arduino temperature sensor: Arduino port not found: /dev/ttyACM0
[1] 82844 abort ./build/observability_sensor ./config/observability_sensor.conf
What is the current bug behavior?
The configuration file values are not read, and as such, crashing the application with the wrong UBS port.
What is the expected correct behavior?
The application reads the configuration file, and parses all values into memory, applying them into all locations.
Relevant logs and/or screenshots
Environment information
- OS (Linux/Unix, macOS, Windows) and version: macOS
- Metrics type (Prometheus, file, Arduino, other harddware senssors): any
- Building from source: Compiler and version (
g++ --version
,clang++ --version
):
╰─ clang++ --version ─╯
Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: arm64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Possible fixes
- Implement a ConfigurationParser class with different Getter types
- Use the config values in all locations (metrics collection interval, Arduino ports, Prometheus host:port, etc.)
Edited by GitLab Demo