forked from TrueCloudLab/frostfs-node
[#493] cmd/node: Add apiclient section to config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
0f4e8d2362
commit
27b4781e95
5 changed files with 67 additions and 0 deletions
27
cmd/neofs-node/config/apiclient/config.go
Normal file
27
cmd/neofs-node/config/apiclient/config.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
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 value of "dial_timeout" config parameter
|
||||
// from "apiclient" section.
|
||||
//
|
||||
// Returns DialTimeoutDefault if 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue