forked from TrueCloudLab/frostfs-node
[#607] cmd/node: Empty Control server address as disable
In previous implementation if Control listen endpoint was omitted in config the gRPC listening endpoint was used instead. Consider empty address as an option to disable the service. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
c444118f47
commit
d1eb9c3b0f
1 changed files with 8 additions and 15 deletions
|
@ -6,7 +6,6 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
controlconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/control"
|
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/local_object_storage/engine"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/services/control"
|
"github.com/nspcc-dev/neofs-node/pkg/services/control"
|
||||||
controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server"
|
controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server"
|
||||||
|
@ -14,6 +13,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func initControlService(c *cfg) {
|
func initControlService(c *cfg) {
|
||||||
|
endpoint := controlconfig.GRPC(c.appCfg).Endpoint()
|
||||||
|
if endpoint == controlconfig.GRPCEndpointDefault {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
pubs := controlconfig.AuthorizedKeys(c.appCfg)
|
pubs := controlconfig.AuthorizedKeys(c.appCfg)
|
||||||
rawPubs := make([][]byte, 0, len(pubs)+1) // +1 for node key
|
rawPubs := make([][]byte, 0, len(pubs)+1) // +1 for node key
|
||||||
|
|
||||||
|
@ -38,21 +42,10 @@ func initControlService(c *cfg) {
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
lis, err := net.Listen("tcp", endpoint)
|
||||||
err error
|
fatalOnErr(err)
|
||||||
lis net.Listener
|
|
||||||
endpoint = controlconfig.GRPC(c.appCfg).Endpoint()
|
|
||||||
)
|
|
||||||
|
|
||||||
if endpoint == "" || endpoint == grpcconfig.Endpoint(c.appCfg) {
|
c.cfgControlService.server = grpc.NewServer()
|
||||||
lis = c.cfgGRPC.listener
|
|
||||||
c.cfgControlService.server = c.cfgGRPC.server
|
|
||||||
} else {
|
|
||||||
lis, err = net.Listen("tcp", endpoint)
|
|
||||||
fatalOnErr(err)
|
|
||||||
|
|
||||||
c.cfgControlService.server = grpc.NewServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
c.onShutdown(func() {
|
c.onShutdown(func() {
|
||||||
stopGRPC("NeoFS Control API", c.cfgControlService.server, c.log)
|
stopGRPC("NeoFS Control API", c.cfgControlService.server, c.log)
|
||||||
|
|
Loading…
Reference in a new issue