forked from TrueCloudLab/frostfs-node
cc7a723d77
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
27 lines
597 B
Go
27 lines
597 B
Go
package apiclientconfig
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
|
)
|
|
|
|
const (
|
|
subsection = "apiclient"
|
|
|
|
// DialTimeoutDefault is a default dial timeout of NeoFS API client connection.
|
|
DialTimeoutDefault = 5 * time.Second
|
|
)
|
|
|
|
// DialTimeout returns the value of "dial_timeout" config parameter
|
|
// from "apiclient" section.
|
|
//
|
|
// Returns DialTimeoutDefault if the value is not positive duration.
|
|
func DialTimeout(c *config.Config) time.Duration {
|
|
v := config.DurationSafe(c.Sub(subsection), "dial_timeout")
|
|
if v > 0 {
|
|
return v
|
|
}
|
|
|
|
return DialTimeoutDefault
|
|
}
|