Skip to content

Split daemon mode configs from core configs #1622

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

Merged
merged 3 commits into from
Jan 17, 2022

Conversation

silvanocerza
Copy link
Contributor

@silvanocerza silvanocerza commented Jan 12, 2022

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

This PR reworks how daemon settings are handled.

  • What is the current behavior?

Currently the settings used by the Arduino CLI when running in daemon or command line mode are shared and stored in the same file, usually ~/.arduino15/arduino-cli.yaml depending on the OS.

This causes some problems since it's not possible to use a single daemon process for multiple users with different settings because they are shared for all the internal instances. The daemon mode settings are strictly tied to the command line mode settings in other terms.

  • What is the new behavior?

The daemon.* settings have been removed from the config read by the arduino-cli when running in command line mode.

The arduino-cli daemon now doesn't read the same config file as the other commands, the --config-file flag is still
present but reads a file with the following keys:

  • ip: IP used to listen for gRPC connections
  • port: Port used listen for gRPC connections
  • daemonize: True to run daemon process in background
  • debug: True to enable debug logging of gRPC calls
  • debug-filter: List of gRPC calls to log when in debug mode
  • verbose: True to print logs in stdout
  • format: Stdout output format
  • no-color: True to disable color output to stdout and stderr
  • log-level: Messages with this level and above will be logged
  • log-file: Path to the file where logs will be written
  • log-format: Output format for the logs

The format of the file can be yaml, json, hcl, toml or ini. An example daemon-config.yaml file could look
like this:

ip: "0.0.0.0"
port: "0"
verbose: true
format: "json"

All the settings in the config file can be override with the following flags:

  • --ip
  • --port
  • --daemonize
  • --debug
  • --debug-filter
  • --verbose, -v
  • --format
  • --no-color
  • --log-level
  • --log-file
  • --log-format

None of those settings will be read from the default arduino-cli.yaml file stored in the .arduino15 or Arduino15
folder anymore when running the arduino-cli daemon command.

Those that start the daemon process will be tasked to manage the config file used by it.

Yes.

  • Other information:

This is the first PR of a series of breaking changes to enhance how the configs are handled internally by the arduino-cli.

This PR breaks the handling of configs when running the arduino-cli in daemon mode since we're changing the behaviour of the --config-file flag for that command.

This will be fixed in a subsequent PR that move the internal storaging of configs from a global variable to the CoreInstance struct.

This PR closes #1620.


See how to contribute

@silvanocerza silvanocerza added type: enhancement Proposed improvement topic: documentation Related to documentation for the project topic: code Related to content of the project itself topic: CLI Related to the command line interface topic: gRPC Related to the gRPC interface labels Jan 12, 2022
@silvanocerza silvanocerza self-assigned this Jan 12, 2022
@silvanocerza
Copy link
Contributor Author

This PR also adds the possibility to customize the IP used in daemon mode so it supersedes #1616.

@silvanocerza silvanocerza force-pushed the scerza/config-split branch 2 times, most recently from 0eab1ba to d1e4956 Compare January 13, 2022 14:44
Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Maybe it's worth opening a feature branch?

@silvanocerza silvanocerza changed the base branch from master to feature/configs-refactoring January 13, 2022 16:59
@silvanocerza
Copy link
Contributor Author

@per1234 docs updated. Thanks for the great suggestions. 👍

Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Silvano!

My only remaining concern is whether the [breaking] prefix should be added to the PR/commit title as specified in the contributor guide:
https://arduino.github.io/arduino-cli/dev/CONTRIBUTING/#breaking

@silvanocerza silvanocerza merged commit 8640b81 into feature/configs-refactoring Jan 17, 2022
@silvanocerza silvanocerza deleted the scerza/config-split branch January 17, 2022 09:14
@silvanocerza
Copy link
Contributor Author

@per1234 I added it after merging, in any case for the time being this lives on a feature branch.

@silvanocerza silvanocerza mentioned this pull request Feb 3, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface topic: code Related to content of the project itself topic: documentation Related to documentation for the project topic: gRPC Related to the gRPC interface type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate settings exclusive to daemon mode from other settings
3 participants