diff --git a/cmd/neofs-node/config/grpc/config.go b/cmd/neofs-node/config/grpc/config.go index 900b428c..865ee07b 100644 --- a/cmd/neofs-node/config/grpc/config.go +++ b/cmd/neofs-node/config/grpc/config.go @@ -83,23 +83,29 @@ func (tls TLSConfig) UseInsecureCrypto() bool { return config.BoolSafe(tls.cfg, "use_insecure_crypto") } -// IterateEndpoints iterates over subsections ["0":"N") (N - "num" value) -// of "grpc" section of c, wrap them into Config and passes to f. +// IterateEndpoints iterates over subsections of "grpc" section of c, +// wrap them into Config and passes to f. +// +// Section names are expected to be consecutive integer numbers, starting from 0. // // Panics if N is not a positive number. func IterateEndpoints(c *config.Config, f func(*Config)) { c = c.Sub("grpc") - num := config.Uint(c, "num") - if num == 0 { - panic("no gRPC server configured") - } - - for i := uint64(0); i < num; i++ { + i := uint64(0) + for ; ; i++ { si := strconv.FormatUint(i, 10) sc := (*Config)(c.Sub(si)) + e := config.StringSafe((*config.Config)(sc), "endpoint") + if e == "" { + break + } + f(sc) } + if i == 0 { + panic("no gRPC server configured") + } } diff --git a/config/example/node.env b/config/example/node.env index 4a89fdf0..70ba0d60 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -28,7 +28,6 @@ NEOFS_NODE_NOTIFICATION_KEY=/key/path NEOFS_NODE_NOTIFICATION_CA=/ca/path # gRPC section -NEOFS_GRPC_NUM=2 ## 0 server NEOFS_GRPC_0_ENDPOINT=s01.neofs.devenv:8080 ### TLS config diff --git a/config/example/node.json b/config/example/node.json index de515fd9..6fee13f4 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -51,7 +51,6 @@ } }, "grpc": { - "num": 2, "0": { "endpoint": "s01.neofs.devenv:8080", "tls": { diff --git a/config/example/node.yaml b/config/example/node.yaml index 676dba95..22329086 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -43,7 +43,6 @@ node: ca: "/ca/path" # path to optional CA certificate grpc: - num: 2 # total number of listener endpoints 0: endpoint: s01.neofs.devenv:8080 # endpoint for gRPC server tls: