cli/tree: Allow to specify rpc-endpoint with config file #1446

Merged
fyrchik merged 1 commit from a-savchuk/frostfs-node:cli-tree-rpc-endpoint into master 2024-10-26 11:30:27 +00:00

View file

@ -2,6 +2,7 @@ package tree
import (
"context"
"fmt"
"strings"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
@ -20,7 +21,13 @@ import (
// after making Tree API public.
func _client() (tree.TreeServiceClient, error) {
var netAddr network.Address
err := netAddr.FromString(viper.GetString(commonflags.RPC))
rpcEndpoint := viper.GetString(commonflags.RPC)
if rpcEndpoint == "" {
return nil, fmt.Errorf("%s is not defined", commonflags.RPC)
}
err := netAddr.FromString(rpcEndpoint)
if err != nil {
return nil, err
}