forked from TrueCloudLab/frostfs-http-gw
connections: refuse to build zero-length pool
Prevent starting a gateway with no nodes configured.
This commit is contained in:
parent
61d61a76cc
commit
ba293a3ff9
1 changed files with 3 additions and 0 deletions
|
@ -35,6 +35,9 @@ func (pb *PoolBuilder) AddNode(address string, weight float64) *PoolBuilder {
|
|||
}
|
||||
|
||||
func (pb *PoolBuilder) Build(ctx context.Context, options *PoolBuilderOptions) (Pool, error) {
|
||||
if len(pb.addresses) == 0 {
|
||||
return nil, errors.New("no NeoFS peers configured")
|
||||
}
|
||||
totalWeight := 0.0
|
||||
for _, w := range pb.weights {
|
||||
totalWeight += w
|
||||
|
|
Loading…
Reference in a new issue