Skip to content

Commit

Permalink
resolver: Read endpoint slice from config
Browse files Browse the repository at this point in the history
Signed-off-by: Evgenii Baidakov <[email protected]>
  • Loading branch information
smallhive committed Jun 26, 2024
1 parent e111e3d commit a9af861
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This document outlines major changes between releases.

## [Unreleased]

### Changed
- Single `rpc_endpoint` config option replaced with multiple endpoints `morph.endpoints` option (#968)

## [0.30.1] - 2024-06-19

### Added
Expand Down
8 changes: 4 additions & 4 deletions cmd/s3-gw/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ func (a *App) initMetrics() {
}

func (a *App) initResolver(ctx context.Context) {
endpoint := a.cfg.GetString(cfgRPCEndpoint)
endpoints := a.cfg.GetStringSlice(cfgRPCEndpoints)

a.log.Info("rpc endpoint", zap.String("address", endpoint))
a.log.Info("rpc endpoints", zap.Strings("address", endpoints))

res, err := resolver.NewContainer(ctx, []string{endpoint})
res, err := resolver.NewContainer(ctx, endpoints)
if err != nil {
a.log.Fatal("resolver", zap.Error(err))
}
Expand Down Expand Up @@ -496,7 +496,7 @@ func (a *App) configReload(ctx context.Context) {
return
}

if err := a.resolverContainer.UpdateResolvers(ctx, []string{a.cfg.GetString(cfgRPCEndpoint)}); err != nil {
if err := a.resolverContainer.UpdateResolvers(ctx, a.cfg.GetStringSlice(cfgRPCEndpoints)); err != nil {
a.log.Warn("failed to update resolvers", zap.Error(err))
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/s3-gw/app_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const ( // Settings.
cfgTreeServiceEndpoint = "tree.service"

// NeoGo.
cfgRPCEndpoint = "rpc_endpoint"
cfgRPCEndpoints = "morph.endpoints"

// Application.
cfgApplicationBuildTime = "app.build_time"
Expand Down Expand Up @@ -237,7 +237,7 @@ func newSettings() *viper.Viper {

peers := flags.StringArrayP(cfgPeers, "p", nil, "set NeoFS nodes")

flags.StringP(cfgRPCEndpoint, "r", "", "set RPC endpoint")
flags.StringP(cfgRPCEndpoints, "r", "", "set RPC endpoints")

domains := flags.StringSliceP(cfgListenDomains, "d", nil, "set domains to be listened")

Expand Down Expand Up @@ -356,7 +356,7 @@ func bindFlags(v *viper.Viper, flags *pflag.FlagSet) error {
if err := v.BindPFlag(cfgMaxClientsDeadline, flags.Lookup(cfgMaxClientsDeadline)); err != nil {
return err
}
if err := v.BindPFlag(cfgRPCEndpoint, flags.Lookup(cfgRPCEndpoint)); err != nil {
if err := v.BindPFlag(cfgRPCEndpoints, flags.Lookup(cfgRPCEndpoints)); err != nil {
return err
}

Expand Down
4 changes: 3 additions & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ tree:
service: node1.neofs:8080

# RPC endpoint and order of resolving of bucket names
rpc_endpoint: http://morph-chain.neofs.devenv:30333
morph:
endpoints:
- http://morph-chain.neofs.devenv:30333

# Metrics
pprof:
Expand Down

0 comments on commit a9af861

Please sign in to comment.