Skip to content

settings: add network.connection_timeout and network.cloud_api.skip_board_detection_calls #2770

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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Set default duration to 60 seconds
  • Loading branch information
cmaglie committed Dec 10, 2024
commit a1da0d8066d42e31e2323deda833b5dfcadeebc0
3 changes: 2 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
[time.ParseDuration()](https://pkg.go.dev/time#ParseDuration), defaults to `720h` (30 days).
- `network` - configuration options related to the network connection.
- `proxy` - URL of the proxy server.
- `connection_timeout` - connection timeout in seconds, defaults to `0` which will wait indefinitely.
- `connection_timeout` - network connection timeout, the value format must be a valid input for
[time.ParseDuration()](https://pkg.go.dev/time#ParseDuration), defaults to `60s` (60 seconds). `0` means it will wait indefinitely.

### Default directories

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/configuration/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func SetDefaults(settings *Settings) {
// network settings
setKeyTypeSchema("network.proxy", "")
setKeyTypeSchema("network.user_agent_ext", "")
setKeyTypeSchema("network.connection_timeout", 0)
setDefaultValueAndKeyTypeSchema("network.connection_timeout", (time.Second * 60).String())

// locale
setKeyTypeSchema("locale", "")
Expand Down
7 changes: 5 additions & 2 deletions internal/cli/configuration/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ func (settings *Settings) ExtraUserAgent() string {
return settings.GetString("network.user_agent_ext")
}

// ConnectionTimeout returns the network connection timeout
func (settings *Settings) ConnectionTimeout() time.Duration {
timeout := settings.GetInt("network.connection_timeout")
return time.Duration(timeout) * time.Second
if timeout, ok, _ := settings.GetDurationOk("network.connection_timeout"); ok {
return timeout
}
return settings.Defaults.GetDuration("network.connection_timeout")
}

// NetworkProxy returns the proxy configuration (mainly used by HTTP clients)
Expand Down
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