Allow user to configure Arduino CLI configuration file location #2731
Labels
topic: code
Related to content of the project itself
topic: theia
Related to the Theia IDE framework
type: enhancement
Proposed improvement
Describe the request
Allow advanced users to cause the instances of Arduino CLI used by Arduino IDE to be configured via a configuration file from any arbitrary path.
🙂 This will significantly facilitate certain advanced use cases.
Describe the current behavior
Many of the non-GUI capabilities of Arduino IDE are provided by the Arduino CLI tool.
Arduino CLI is configured via a configuration file. When Arduino IDE invokes Arduino CLI, it specifies the use of the configuration file from a specific hardcoded path:
arduino-ide/arduino-ide-extension/src/node/arduino-daemon-impl.ts
Lines 132 to 133 in 0f9f0d0
This hardcoded path is
$HOME/.arduinoIDE/arduino-cli.yaml
.For some advanced use cases, the location under the user home directory is very inconvenient:
🙁 The user either cannot achieve their desired use case, or is forced to use inconvenient and convoluted means to do so.
Arduino IDE version
0f9f0d0
Operating system
Operating system version
Additional context
This is a capability that is only required by advanced users, so it is not necessary to provide the capability in a beginner friendly manner. The complexity of Arduino IDE's primary UI MUST NOT be increased through the implementation of this feature. It is perfectly fine for the configuration to only be available through an environment variable or command line flag.
There are a couple of possibilities by which this might be accomplished:
Allow the user to set the Arduino IDE configuration folder path
The hardcoded location for the Arduino CLI configuration file used by Arduino IDE is under the Arduino IDE configuration folder (i.e.,
$HOME/.arduinoIDE
), so if the Arduino IDE configuration folder location was made configurable, this would also make the Arduino CLI configuration file location configurable.The Eclipse Theia Platform IDE framework upon which Arduino IDE is built already has the capability for the user to set an arbitrary configuration folder location via the
THEIA_CONFIG_DIR
environment variable:https://github.com/eclipse-theia/theia/blob/v1.57.0/packages/core/src/node/env-variables/env-variables-server.ts#L49-L53
However, that system is overridden in the Arduino IDE codebase:
arduino-ide/arduino-ide-extension/src/node/theia/env-variables/env-variables-server.ts
Lines 19 to 30 in 0f9f0d0
I believe the reason for this override was that, at the time it was implemented, Theia hardcoded the default configuration folder path as
$HOME/.theia
and we wanted a folder name that matches the application. However, the ability for each application to configure a custom default configuration folder name has since been added to Theia:eclipse-theia/theia#14319
So there is now no point in us maintaining the override code in this project.
Respect the
ARDUINO_CONFIG_FILE
environment variableArduino CLI supports specifying the configuration file location via an environment variable:
https://arduino.github.io/arduino-cli/dev/configuration/#locations
Arduino IDE's use of the
--config-file
flag in thearduino-cli daemon
invocation makes it impossible for the user to configure the path via theARDUINO_CONFIG_FILE
environment variable. This could be allowed if Arduino IDE checked whether theARDUINO_CONFIG_FILE
environment variable was set, and if so omitted the--config-file
command line flag from the invocation (and also using that path if it does any direct access of the configuration file).Additional requests
Related
Keywords
"configuration directory"
Issue checklist
The text was updated successfully, but these errors were encountered: