Skip to content

Allow user to configure Arduino CLI configuration file location #2731

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

Open
3 tasks done
per1234 opened this issue May 17, 2025 · 0 comments
Open
3 tasks done

Allow user to configure Arduino CLI configuration file location #2731

per1234 opened this issue May 17, 2025 · 0 comments
Labels
topic: code Related to content of the project itself topic: theia Related to the Theia IDE framework type: enhancement Proposed improvement

Comments

@per1234
Copy link
Contributor

per1234 commented May 17, 2025

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:

'--config-file',
cliConfigPath,

This hardcoded path is $HOME/.arduinoIDE/arduino-cli.yaml.

For some advanced use cases, the location under the user home directory is very inconvenient:

  • Institutional installations where the system administrator wishes a single configuration to be used by all users
  • "Portable" use cases where the user wants to carry a self-contained installation of Arduino IDE and project dependencies on a portable drive for use on any computer.
  • Having a dedicated configuration and dependencies environment for each specific project.

🙁 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

  • Linux
  • macOS
  • Windows

Operating system version

  • Ubuntu 24.04
  • macOS Sequoia
  • Windows 11

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

    protected async createConfigDirUri(): Promise<string> {
        if (process.env.THEIA_CONFIG_DIR) {
            // this has been explicitly set by the user, so we do not override its value
            return FileUri.create(process.env.THEIA_CONFIG_DIR).toString();
        }

However, that system is overridden in the Arduino IDE codebase:

export class ConfigDirUriProvider {
private uri: URI | undefined;
configDirUri(): URI {
if (!this.uri) {
this.uri = FileUri.create(
join(homedir(), BackendApplicationConfigProvider.get().configDirName)
);
}
return this.uri;
}
}

join(homedir(), BackendApplicationConfigProvider.get().configDirName)

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 variable

Arduino CLI supports specifying the configuration file location via an environment variable:

https://arduino.github.io/arduino-cli/dev/configuration/#locations

The configuration file is searched in the following locations, in order of priority:

  1. Location specified by the --config-file command line flag
  2. Location specified by the ARDUINO_CONFIG_FILE environment variable

Arduino IDE's use of the --config-file flag in the arduino-cli daemon invocation makes it impossible for the user to configure the path via the ARDUINO_CONFIG_FILE environment variable. This could be allowed if Arduino IDE checked whether the ARDUINO_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

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: theia Related to the Theia IDE framework labels May 17, 2025
@per1234 per1234 mentioned this issue May 17, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself topic: theia Related to the Theia IDE framework type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

1 participant