Skip to content

Commit 2d4aee1

Browse files
committed
Added option to disable call to Arduino Cloud API for board detection
1 parent 4076037 commit 2d4aee1

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

commands/service_board_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func identify(pme *packagemanager.Explorer, port *discovery.Port, settings *conf
170170

171171
// if installed cores didn't recognize the board, try querying
172172
// the builder API if the board is a USB device port
173-
if len(boards) == 0 && !skipCloudAPI {
173+
if len(boards) == 0 && !skipCloudAPI && !settings.SkipCloudApiForBoardDetection() {
174174
items, err := identifyViaCloudAPI(port.Properties, settings)
175175
if err != nil {
176176
// this is bad, but keep going

docs/configuration.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
- `network` - configuration options related to the network connection.
4747
- `proxy` - URL of the proxy server.
4848
- `connection_timeout` - network connection timeout, the value format must be a valid input for
49-
[time.ParseDuration()](https://pkg.go.dev/time#ParseDuration), defaults to `60s` (60 seconds). `0` means it will wait indefinitely.
49+
[time.ParseDuration()](https://pkg.go.dev/time#ParseDuration), defaults to `60s` (60 seconds). `0` means it will
50+
wait indefinitely.
51+
- `cloud_api.skip_board_detection_calls` - if set to `true` it will make the Arduino CLI skip network calls to
52+
Arduino Cloud API to help detection of an unknown board.
5053

5154
### Default directories
5255

internal/cli/configuration/configuration.schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@
154154
"description": "timeout for network connections, defaults to '30s'",
155155
"type": "string",
156156
"pattern": "^[+-]?(([0-9]+(\\.[0-9]*)?|(\\.[0-9]+))(ns|us|µs|μs|ms|s|m|h))+$"
157+
},
158+
"cloud_api": {
159+
"description": "settings related to the Arduino Cloud API.",
160+
"type": "object",
161+
"properties": {
162+
"skip_board_detection_calls": {
163+
"description": "do not call the Arduino Cloud API to detect an unknown board",
164+
"type": "boolean"
165+
}
166+
}
157167
}
158168
}
159169
},

internal/cli/configuration/defaults.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ func SetDefaults(settings *Settings) {
7272
setKeyTypeSchema("network.proxy", "")
7373
setKeyTypeSchema("network.user_agent_ext", "")
7474
setDefaultValueAndKeyTypeSchema("network.connection_timeout", (time.Second * 60).String())
75+
// network: Arduino Cloud API settings
76+
setKeyTypeSchema("network.cloud_api.skip_board_detection_calls", false)
7577

7678
// locale
7779
setKeyTypeSchema("locale", "")

internal/cli/configuration/network.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ func (settings *Settings) ConnectionTimeout() time.Duration {
6767
return settings.Defaults.GetDuration("network.connection_timeout")
6868
}
6969

70+
// SkipCloudApiForBoardDetection returns whether the cloud API should be ignored for board detection
71+
func (settings *Settings) SkipCloudApiForBoardDetection() bool {
72+
return settings.GetBool("network.cloud_api.skip_board_detection_calls")
73+
}
74+
7075
// NetworkProxy returns the proxy configuration (mainly used by HTTP clients)
7176
func (settings *Settings) NetworkProxy() (*url.URL, error) {
7277
if proxyConfig, ok, _ := settings.GetStringOk("network.proxy"); !ok {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy