forked from TrueCloudLab/frostfs-node
[#1474] neofs-node/config: Remove num
from the "grpc" section
It isn't needed and can be replaced with additional checks during the iteration. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
0e28902b0f
commit
73a88c2965
4 changed files with 14 additions and 11 deletions
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
}
|
||||
},
|
||||
"grpc": {
|
||||
"num": 2,
|
||||
"0": {
|
||||
"endpoint": "s01.neofs.devenv:8080",
|
||||
"tls": {
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue