diff --git a/cmd/neofs-node/config/mainchain/config.go b/cmd/neofs-node/config/mainchain/config.go deleted file mode 100644 index a231c015..00000000 --- a/cmd/neofs-node/config/mainchain/config.go +++ /dev/null @@ -1,35 +0,0 @@ -package mainchainconfig - -import ( - "time" - - "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" -) - -const ( - subsection = "mainchain" - - // DialTimeoutDefault is a default dial timeout of main chain client connection. - DialTimeoutDefault = 5 * time.Second -) - -// RPCEndpoint returns a list of the values of "rpc_endpoint" config parameter -// from "mainchain" section. -// -// Returns empty list if the value is not a non-empty string array. -func RPCEndpoint(c *config.Config) []string { - return config.StringSliceSafe(c.Sub(subsection), "rpc_endpoint") -} - -// DialTimeout returns the value of "dial_timeout" config parameter -// from "mainchain" 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 -} diff --git a/cmd/neofs-node/config/mainchain/config_test.go b/cmd/neofs-node/config/mainchain/config_test.go deleted file mode 100644 index 3335ac13..00000000 --- a/cmd/neofs-node/config/mainchain/config_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package mainchainconfig_test - -import ( - "testing" - "time" - - "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" - mainchainconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/mainchain" - configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test" - "github.com/stretchr/testify/require" -) - -func TestMainchainSection(t *testing.T) { - t.Run("defaults", func(t *testing.T) { - empty := configtest.EmptyConfig() - - require.Empty(t, mainchainconfig.RPCEndpoint(empty)) - require.Equal(t, mainchainconfig.DialTimeoutDefault, mainchainconfig.DialTimeout(empty)) - }) - - const path = "../../../../config/example/node" - - var rpcs = []string{ - "https://rpc1.n3.nspcc.ru:30341", - "https://rpc2.n3.nspcc.ru:30341", - } - - var fileConfigTest = func(c *config.Config) { - require.Equal(t, rpcs, mainchainconfig.RPCEndpoint(c)) - require.Equal(t, 30*time.Second, mainchainconfig.DialTimeout(c)) - } - - configtest.ForEachFileType(path, fileConfigTest) - - t.Run("ENV", func(t *testing.T) { - configtest.ForEnvFileType(path, fileConfigTest) - }) -} diff --git a/config/example/node.env b/config/example/node.env index dc82860e..1c5c3c99 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -58,10 +58,6 @@ NEOFS_MORPH_DIAL_TIMEOUT=30s NEOFS_MORPH_DISABLE_CACHE=true NEOFS_MORPH_RPC_ENDPOINT="wss://rpc1.morph.fs.neo.org:40341/ws wss://rpc2.morph.fs.neo.org:40341/ws" -# Main chain section (optional) -NEOFS_MAINCHAIN_DIAL_TIMEOUT=30s -NEOFS_MAINCHAIN_RPC_ENDPOINT="https://rpc1.n3.nspcc.ru:30341 https://rpc2.n3.nspcc.ru:30341" - # API Client section NEOFS_APICLIENT_DIAL_TIMEOUT=15s diff --git a/config/example/node.json b/config/example/node.json index 06d04e10..411b1666 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -99,13 +99,6 @@ "wss://rpc2.morph.fs.neo.org:40341/ws" ] }, - "mainchain": { - "dial_timeout": "30s", - "rpc_endpoint": [ - "https://rpc1.n3.nspcc.ru:30341", - "https://rpc2.n3.nspcc.ru:30341" - ] - }, "apiclient": { "dial_timeout": "15s" }, diff --git a/config/example/node.yaml b/config/example/node.yaml index 1921b141..79421cc4 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -85,12 +85,6 @@ morph: - wss://rpc1.morph.fs.neo.org:40341/ws - wss://rpc2.morph.fs.neo.org:40341/ws -mainchain: # DEPRECATED section, is not used and not read - dial_timeout: 30s # timeout for main chain NEO RPC client connection - rpc_endpoint: # main chain NEO RPC endpoints; are shuffled and used one by one until the first success - - https://rpc1.n3.nspcc.ru:30341 - - https://rpc2.n3.nspcc.ru:30341 - apiclient: dial_timeout: 15s # timeout for NEOFS API client connection