forked from TrueCloudLab/frostfs-node
[#493] node: Make list of main chain's RPC endpoints optional
Currently main chain's client is unused, therefore, it is not advisable to require mandatory setting of addresses. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
c36bca1ddc
commit
3622e4165a
1 changed files with 4 additions and 4 deletions
|
@ -28,9 +28,9 @@ var (
|
||||||
func initMorphComponents(c *cfg) {
|
func initMorphComponents(c *cfg) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
fn := func(endpointCfg, dialTOCfg string, handler func(*client.Client)) {
|
fn := func(endpointCfg, dialTOCfg string, handler func(*client.Client), required bool) {
|
||||||
addresses := c.viper.GetStringSlice(endpointCfg)
|
addresses := c.viper.GetStringSlice(endpointCfg)
|
||||||
if len(addresses) == 0 {
|
if required && len(addresses) == 0 {
|
||||||
fatalOnErr(errNoRPCEndpoints)
|
fatalOnErr(errNoRPCEndpoints)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +68,11 @@ func initMorphComponents(c *cfg) {
|
||||||
// since current function initializes sidechain components
|
// since current function initializes sidechain components
|
||||||
fn(cfgMainChainRPCAddress, cfgMainChainDialTimeout, func(cli *client.Client) {
|
fn(cfgMainChainRPCAddress, cfgMainChainDialTimeout, func(cli *client.Client) {
|
||||||
c.mainChainClient = cli
|
c.mainChainClient = cli
|
||||||
})
|
}, false)
|
||||||
|
|
||||||
fn(cfgMorphRPCAddress, "", func(cli *client.Client) {
|
fn(cfgMorphRPCAddress, "", func(cli *client.Client) {
|
||||||
c.cfgMorph.client = cli
|
c.cfgMorph.client = cli
|
||||||
})
|
}, true)
|
||||||
|
|
||||||
staticClient, err := client.NewStatic(
|
staticClient, err := client.NewStatic(
|
||||||
c.cfgMorph.client,
|
c.cfgMorph.client,
|
||||||
|
|
Loading…
Reference in a new issue