|
| 1 | +## Configuration keys |
| 2 | + |
| 3 | +* `board_manager` |
| 4 | + * `additional_urls` - the URLs to any additional Board Manager package index |
| 5 | + files needed for your boards platforms. |
| 6 | +* `daemon` - options related to running Arduino CLI as a [gRPC] server. |
| 7 | + * `port` - TCP port used for gRPC client connections. |
| 8 | +* `directories` - directories used by Arduino CLI. |
| 9 | + * `data` - directory used to store Board/Library Manager index files and |
| 10 | + Board Manager platform installations. |
| 11 | + * `downloads` - directory used to stage downloaded archives during |
| 12 | + Board/Library Manager installations. |
| 13 | + * `user` - the equivalent of the Arduino IDE's |
| 14 | + ["sketchbook" directory][sketchbook directory]. Library Manager |
| 15 | + installations are made to the `libraries` subdirectory of the user |
| 16 | + directory. |
| 17 | +* `logging` - configuration options for Arduino CLI's logs. |
| 18 | + * `file` - path to the file where logs will be written. |
| 19 | + * `format` - output format for the logs. Allowed values are `text` or |
| 20 | + `json`. |
| 21 | + * `level` - messages with this level and above will be logged. Valid levels |
| 22 | + are: `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `panic`. |
| 23 | +* `telemetry` - settings related to the collection of data used for continued |
| 24 | +improvement of Arduino CLI. |
| 25 | + * `addr` - TCP port used for telemetry communication. |
| 26 | + * `enabled` - controls the use of telemetry. |
| 27 | + |
| 28 | +## Configuration methods |
| 29 | + |
| 30 | +Arduino CLI may be configured in three ways: |
| 31 | + |
| 32 | +1. Command line flags |
| 33 | +1. Environment variables |
| 34 | +1. Configuration file |
| 35 | + |
| 36 | +If a configuration option is configured by multiple methods, the value set by |
| 37 | +the method highest on the above list overwrites the ones below it. |
| 38 | + |
| 39 | +If a configuration option is not set, Arduino CLI uses a default value. |
| 40 | + |
| 41 | +[`arduino-cli config dump`][arduino-cli config dump] displays the current |
| 42 | +configuration values. |
| 43 | + |
| 44 | +### Command line flags |
| 45 | + |
| 46 | +Arduino CLI's command line flags are documented in the command line help and the |
| 47 | +[Arduino CLI command reference]. |
| 48 | + |
| 49 | +#### Example |
| 50 | + |
| 51 | +Setting an additional Board Manager URL using the |
| 52 | +[`--additional-urls`][arduino-cli global flags] command line flag: |
| 53 | + |
| 54 | +```shell |
| 55 | +$ arduino-cli core update-index --additional-urls https://downloads.arduino.cc/packages/package_staging_index.json |
| 56 | +``` |
| 57 | + |
| 58 | +### Environment variables |
| 59 | + |
| 60 | +All configuration options can be set via environment variables. The variable |
| 61 | +names start with `ARDUINO`, followed by the configuration key names, with each |
| 62 | +component separated by `_`. For example, the `ARDUINO_DIRECTORIES_USER` |
| 63 | +environment variable sets the `directories.user` configuration option. |
| 64 | + |
| 65 | +On Linux or macOS, you can use the [`export` command][export command] to set |
| 66 | +environment variables. On Windows cmd, you can use the |
| 67 | +[`set` command][set command]. |
| 68 | + |
| 69 | +#### Example |
| 70 | + |
| 71 | +Setting an additional Board Manager URL using the |
| 72 | +`ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS` environment variable: |
| 73 | + |
| 74 | +```sh |
| 75 | +$ export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS=https://downloads.arduino.cc/packages/package_staging_index.json |
| 76 | +``` |
| 77 | + |
| 78 | +### Configuration file |
| 79 | + |
| 80 | +[`arduino-cli config init`][arduino-cli config init] creates or updates a |
| 81 | +configuration file with the current configuration settings. |
| 82 | + |
| 83 | +This allows saving the options set by command line flags or environment |
| 84 | +variables. For example: |
| 85 | + |
| 86 | +```sh |
| 87 | +arduino-cli config init --additional-urls https://downloads.arduino.cc/packages/package_staging_index.json |
| 88 | +``` |
| 89 | + |
| 90 | +#### File name |
| 91 | + |
| 92 | +The configuration file must be named `arduino-cli`, with the appropriate file |
| 93 | +extension for the file's format. |
| 94 | + |
| 95 | +#### Supported formats |
| 96 | + |
| 97 | +`arduino-cli config init` creates a YAML file, however a variety of common |
| 98 | +formats are supported: |
| 99 | + |
| 100 | +* [JSON] |
| 101 | +* [TOML] |
| 102 | +* [YAML] |
| 103 | +* [Java properties file] |
| 104 | +* [HCL] |
| 105 | +* envfile |
| 106 | +* [INI] |
| 107 | + |
| 108 | +#### Locations |
| 109 | + |
| 110 | +Configuration files in the following locations are recognized by Arduino CLI: |
| 111 | + |
| 112 | +1. Location specified by the [`--config-file`][Arduino CLI command reference] |
| 113 | +command line flag |
| 114 | +1. Current working directory |
| 115 | +1. Any parent directory of the current working directory (more immediate parents |
| 116 | +having higher precedence) |
| 117 | +1. Arduino CLI data directory (as configured by `directories.data`) |
| 118 | + |
| 119 | +If multiple configuration files are present, the one highest on the above list |
| 120 | +is used. Configuration files are not combined. |
| 121 | + |
| 122 | +The location of the active configuration file can be determined by running the |
| 123 | +command: |
| 124 | + |
| 125 | +```sh |
| 126 | +arduino-cli config dump --verbose |
| 127 | +``` |
| 128 | + |
| 129 | +#### Example |
| 130 | + |
| 131 | +Setting an additional Board Manager URL using a YAML format configuration file: |
| 132 | + |
| 133 | +```yaml |
| 134 | +board_manager: |
| 135 | + additional_urls: |
| 136 | + - https://downloads.arduino.cc/packages/package_staging_index.json |
| 137 | +``` |
| 138 | +
|
| 139 | +Doing the same using a TOML format file: |
| 140 | +
|
| 141 | +```toml |
| 142 | +[board_manager] |
| 143 | +additional_urls = [ "https://downloads.arduino.cc/packages/package_staging_index.json" ] |
| 144 | +``` |
| 145 | + |
| 146 | + |
| 147 | +[gRPC]: https://grpc.io |
| 148 | +[sketchbook directory]: sketch-specification.md#sketchbook |
| 149 | +[arduino-cli config dump]: ../commands/arduino-cli_config_dump |
| 150 | +[Arduino CLI command reference]: ../commands/arduino-cli |
| 151 | +[arduino-cli global flags]: ../commands/arduino-cli_config/#options-inherited-from-parent-commands |
| 152 | +[export command]: https://ss64.com/bash/export.html |
| 153 | +[set command]: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1 |
| 154 | +[arduino-cli config init]: ../commands/arduino-cli_config_init |
| 155 | +[JSON]: https://www.json.org |
| 156 | +[TOML]: https://github.com/toml-lang/toml |
| 157 | +[YAML]: https://en.wikipedia.org/wiki/YAML |
| 158 | +[Java properties file]: https://en.wikipedia.org/wiki/.properties |
| 159 | +[HCL]: https://github.com/hashicorp/hcl |
| 160 | +[INI]: https://en.wikipedia.org/wiki/INI_file |
0 commit comments