[#493] cmd/node: Use new config for control service configuration

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-06-01 16:34:14 +03:00 committed by Alex Vanin
parent c828848024
commit 44b19c145f
2 changed files with 3 additions and 13 deletions

View file

@ -389,8 +389,6 @@ func defaultConfiguration(v *viper.Viper) {
v.SetDefault(cfgReplicatorPutTimeout, 5*time.Second)
v.SetDefault(cfgObjectPutPoolSize, 10)
v.SetDefault(cfgCtrlSvcAuthorizedKeys, []string{})
}
func (c *cfg) LocalAddress() *network.Address {

View file

@ -8,6 +8,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/object"
crypto "github.com/nspcc-dev/neofs-crypto"
controlconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/control"
grpcconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/grpc"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
@ -15,17 +16,8 @@ import (
"google.golang.org/grpc"
)
const (
cfgCtrlSvcSection = "control"
cfgCtrlSvcAuthorizedKeys = cfgCtrlSvcSection + ".authorized_keys"
cfgCtrlSvcGRPCSection = cfgCtrlSvcSection + ".grpc"
cfgCtrlGRPCEndpoint = cfgCtrlSvcGRPCSection + ".endpoint"
)
func initControlService(c *cfg) {
strKeys := c.viper.GetStringSlice(cfgCtrlSvcAuthorizedKeys)
strKeys := controlconfig.AuthorizedKeysString(c.appCfg)
keys := make([][]byte, 0, len(strKeys)+1) // +1 for node key
keys = append(keys, crypto.MarshalPublicKey(&c.key.PublicKey))
@ -59,7 +51,7 @@ func initControlService(c *cfg) {
var (
err error
lis net.Listener
endpoint = c.viper.GetString(cfgCtrlGRPCEndpoint)
endpoint = controlconfig.GRPC(c.appCfg).Endpoint()
)
if endpoint == "" || endpoint == grpcconfig.Endpoint(c.appCfg) {