forked from TrueCloudLab/frostfs-node
[#1342] neofs-node: Use the default endpoint for tree service
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
8844d9b2db
commit
36e24f7f78
6 changed files with 5 additions and 101 deletions
|
@ -1,39 +0,0 @@
|
|||
package treeconfig
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
||||
)
|
||||
|
||||
// GRPCConfig is a wrapper over "grpc" config section which provides access
|
||||
// to gRPC configuration of control service.
|
||||
type GRPCConfig struct {
|
||||
cfg *config.Config
|
||||
}
|
||||
|
||||
const (
|
||||
subsection = "tree"
|
||||
grpcSubsection = "grpc"
|
||||
|
||||
// GRPCEndpointDefault is a default endpoint of gRPC Control service.
|
||||
GRPCEndpointDefault = ""
|
||||
)
|
||||
|
||||
// GRPC returns structure that provides access to "grpc" subsection of
|
||||
// "tree" section.
|
||||
func GRPC(c *config.Config) GRPCConfig {
|
||||
return GRPCConfig{
|
||||
c.Sub(subsection).Sub(grpcSubsection),
|
||||
}
|
||||
}
|
||||
|
||||
// Endpoint returns value of "endpoint" config parameter.
|
||||
//
|
||||
// Returns GRPCEndpointDefault if value is not a non-empty string.
|
||||
func (g GRPCConfig) Endpoint() string {
|
||||
v := config.String(g.cfg, "endpoint")
|
||||
if v != "" {
|
||||
return v
|
||||
}
|
||||
|
||||
return GRPCEndpointDefault
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue