forked from TrueCloudLab/frostfs-node
[#493] cmd/node: Fix linter errors in config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
e9e986ac71
commit
a2547da5ae
9 changed files with 19 additions and 12 deletions
|
@ -19,7 +19,7 @@ const (
|
|||
// 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 {
|
||||
if v > 0 {
|
||||
return v
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ func New(_ Prm, opts ...Option) *Config {
|
|||
|
||||
err := v.ReadInConfig()
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to read config: %v", err))
|
||||
panic(fmt.Errorf("failed to read config: %w", err))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const (
|
|||
// RemoverBatchSizeDefault is a default batch size for Shard GC's remover.
|
||||
RemoverBatchSizeDefault = 100
|
||||
|
||||
// RemoverSleepInterval is a default sleep interval of Shard GC's remover.
|
||||
// RemoverSleepIntervalDefault is a default sleep interval of Shard GC's remover.
|
||||
RemoverSleepIntervalDefault = time.Minute
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
// config defaults
|
||||
const (
|
||||
// LevelDefault is a default logger level
|
||||
// LevelDefault is a default logger level.
|
||||
LevelDefault = "info"
|
||||
)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ func RPCEndpoint(c *config.Config) []string {
|
|||
// 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 {
|
||||
if v > 0 {
|
||||
return v
|
||||
}
|
||||
|
||||
|
|
|
@ -9,17 +9,20 @@ import (
|
|||
const (
|
||||
subsection = "metrics"
|
||||
|
||||
// ShutdownTimeoutDefault is a default value for metrics HTTP service timeout.
|
||||
ShutdownTimeoutDefault = 30 * time.Second
|
||||
AddressDefault = ""
|
||||
|
||||
// AddressDefault is a default value for metrics HTTP service endpoint.
|
||||
AddressDefault = ""
|
||||
)
|
||||
|
||||
// ShutdownTimeout returns value of "shutdown_timeout" config parameter
|
||||
// from "metrics" section.
|
||||
//
|
||||
// Returns ShutdownTimeoutDefault if value is not set.
|
||||
// Returns ShutdownTimeoutDefault if value is not positive duration.
|
||||
func ShutdownTimeout(c *config.Config) time.Duration {
|
||||
v := config.DurationSafe(c.Sub(subsection), "shutdown_timeout")
|
||||
if v != 0 {
|
||||
if v > 0 {
|
||||
return v
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ func NotificationEndpoint(c *config.Config) []string {
|
|||
// 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 {
|
||||
if v > 0 {
|
||||
return v
|
||||
}
|
||||
|
||||
|
|
|
@ -9,17 +9,20 @@ import (
|
|||
const (
|
||||
subsection = "profiler"
|
||||
|
||||
// ShutdownTimeoutDefault is a default value for profiler HTTP service timeout.
|
||||
ShutdownTimeoutDefault = 30 * time.Second
|
||||
AddressDefault = ""
|
||||
|
||||
// AddressDefault is a default value for profiler HTTP service endpoint.
|
||||
AddressDefault = ""
|
||||
)
|
||||
|
||||
// ShutdownTimeout returns value of "shutdown_timeout" config parameter
|
||||
// from "profiler" section.
|
||||
//
|
||||
// Returns ShutdownTimeoutDefault if value is not set.
|
||||
// Returns ShutdownTimeoutDefault if value is not positive duration.
|
||||
func ShutdownTimeout(c *config.Config) time.Duration {
|
||||
v := config.DurationSafe(c.Sub(subsection), "shutdown_timeout")
|
||||
if v != 0 {
|
||||
if v > 0 {
|
||||
return v
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ func fromEnvFile(path string) *config.Config {
|
|||
var p config.Prm
|
||||
|
||||
loadEnv(path) // github.com/joho/godotenv can do that as well
|
||||
|
||||
return config.New(p)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue