Separate settings exclusive to daemon mode from other settings #1620
Labels
conclusion: resolved
Issue was resolved
topic: CLI
Related to the command line interface
topic: code
Related to content of the project itself
topic: gRPC
Related to the gRPC interface
type: enhancement
Proposed improvement
Currently there is a central place where all settings are stored, the
arduino-cli.yaml
file. It usually looks something like this:This file stores settings that are needed by the Arduino CLI when running as a
daemon
and when running as a command line tool.When running in
daemon
mode the gRPC consumers connected to it can create multiple internal instances but the settings are shared between them, so we can't have different clients with different settings connected to the samedaemon
process because if one of the client edits the settings it would change for everyone connected.We could solve the above problem by storing the settings in the internal
CoreInstance
created by the gRPC clients, but that causes also some other issues. What would happen if a client connects to thedaemon
and changes the port used by thedaemon
? It would break the connection for all clients the next time thedaemon
is restarted, so it must not be possible for the gRPC clients to change that. What about logging? Why should the clients be able to change thedaemon
settings if they might not even be tasked with running it?When running the Arduino CLI as a normal command line tool we create a single internal instance, so we can treat it similarly as a gRPC client. Though when running as a command line tool we might need logging too, as much as when we run it in
daemon
mode.Given the above information we must separate some settings from the essential ones, see
daemon
config, and some other settings instead must be duplicated both fordaemon
mode and command line mode, seemetrics
andlogging
configs.This change is necessary to move the settings inside the CoreInstance.
If we'd move the settings inside the instance before separating the daemon settings from the other ones we wouldn't be able to run the daemon with the correct settings, since we'd have first to create an instance to be able to access them.
The text was updated successfully, but these errors were encountered: