[#1609] config: Remove mainchain section
It is deprecated and unused, there is no need to have it in the documentation. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
a4ed91f9b5
commit
aed83d1660
5 changed files with 0 additions and 90 deletions
|
@ -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
|
|
||||||
}
|
|
|
@ -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)
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -58,10 +58,6 @@ NEOFS_MORPH_DIAL_TIMEOUT=30s
|
||||||
NEOFS_MORPH_DISABLE_CACHE=true
|
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"
|
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
|
# API Client section
|
||||||
NEOFS_APICLIENT_DIAL_TIMEOUT=15s
|
NEOFS_APICLIENT_DIAL_TIMEOUT=15s
|
||||||
|
|
||||||
|
|
|
@ -99,13 +99,6 @@
|
||||||
"wss://rpc2.morph.fs.neo.org:40341/ws"
|
"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": {
|
"apiclient": {
|
||||||
"dial_timeout": "15s"
|
"dial_timeout": "15s"
|
||||||
},
|
},
|
||||||
|
|
|
@ -85,12 +85,6 @@ morph:
|
||||||
- wss://rpc1.morph.fs.neo.org:40341/ws
|
- wss://rpc1.morph.fs.neo.org:40341/ws
|
||||||
- wss://rpc2.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:
|
apiclient:
|
||||||
dial_timeout: 15s # timeout for NEOFS API client connection
|
dial_timeout: 15s # timeout for NEOFS API client connection
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue