diff --git a/cmd/neofs-node/config/apiclient/config.go b/cmd/neofs-node/config/apiclient/config.go index 4961de7d02..02d7b635aa 100644 --- a/cmd/neofs-node/config/apiclient/config.go +++ b/cmd/neofs-node/config/apiclient/config.go @@ -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 } diff --git a/cmd/neofs-node/config/config.go b/cmd/neofs-node/config/config.go index 080a88f6de..dd5e035933 100644 --- a/cmd/neofs-node/config/config.go +++ b/cmd/neofs-node/config/config.go @@ -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)) } } diff --git a/cmd/neofs-node/config/engine/shard/gc/config.go b/cmd/neofs-node/config/engine/shard/gc/config.go index 3ff87ec6ba..341abe2818 100644 --- a/cmd/neofs-node/config/engine/shard/gc/config.go +++ b/cmd/neofs-node/config/engine/shard/gc/config.go @@ -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 ) diff --git a/cmd/neofs-node/config/logger/config.go b/cmd/neofs-node/config/logger/config.go index e443020ed1..156a50770f 100644 --- a/cmd/neofs-node/config/logger/config.go +++ b/cmd/neofs-node/config/logger/config.go @@ -6,7 +6,7 @@ import ( // config defaults const ( - // LevelDefault is a default logger level + // LevelDefault is a default logger level. LevelDefault = "info" ) diff --git a/cmd/neofs-node/config/mainchain/config.go b/cmd/neofs-node/config/mainchain/config.go index 3fa38d82bf..b11d38a472 100644 --- a/cmd/neofs-node/config/mainchain/config.go +++ b/cmd/neofs-node/config/mainchain/config.go @@ -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 } diff --git a/cmd/neofs-node/config/metrics/config.go b/cmd/neofs-node/config/metrics/config.go index 17510ed30b..348edcb718 100644 --- a/cmd/neofs-node/config/metrics/config.go +++ b/cmd/neofs-node/config/metrics/config.go @@ -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 } diff --git a/cmd/neofs-node/config/morph/config.go b/cmd/neofs-node/config/morph/config.go index 43784e925a..b6da9eb71d 100644 --- a/cmd/neofs-node/config/morph/config.go +++ b/cmd/neofs-node/config/morph/config.go @@ -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 } diff --git a/cmd/neofs-node/config/profiler/config.go b/cmd/neofs-node/config/profiler/config.go index 12d574bbc6..08fe65bf5a 100644 --- a/cmd/neofs-node/config/profiler/config.go +++ b/cmd/neofs-node/config/profiler/config.go @@ -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 } diff --git a/cmd/neofs-node/config/test/config.go b/cmd/neofs-node/config/test/config.go index e56f6d61ba..410ea57e87 100644 --- a/cmd/neofs-node/config/test/config.go +++ b/cmd/neofs-node/config/test/config.go @@ -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) }