Skip to content

Commit

Permalink
ensure ddb kvstore can use client_name as well (kvstore.name.ddb.clie…
Browse files Browse the repository at this point in the history
…nt_name)
  • Loading branch information
applike-ss committed May 23, 2023
1 parent 7658538 commit fd4ce31
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/kvstore/configurable.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ const (
TypeRedis = "redis"
)

type DdbSettings struct {
ClientName string `cfg:"client_name" default:"default"`
}

type ChainConfiguration struct {
Project string `cfg:"project"`
Family string `cfg:"family"`
Group string `cfg:"group"`
Application string `cfg:"application"`
Type string `cfg:"type" default:"chain" validate:"eq=chain"`
Elements []string `cfg:"elements" validate:"min=1"`
Ddb DdbSettings `cfg:"ddb"`
Ttl time.Duration `cfg:"ttl"`
BatchSize int `cfg:"batch_size" default:"100" validate:"min=1"`
MissingCacheEnabled bool `cfg:"missing_cache_enabled" default:"false"`
Expand Down Expand Up @@ -80,6 +85,7 @@ func newKvStoreChainFromConfig[T any](ctx context.Context, config cfg.Config, lo
Group: configuration.Group,
Application: configuration.Application,
},
DdbSettings: configuration.Ddb,
Name: name,
Ttl: configuration.Ttl,
BatchSize: configuration.BatchSize,
Expand Down
1 change: 1 addition & 0 deletions pkg/kvstore/ddb.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func NewDdbKvStore[T any](ctx context.Context, config cfg.Config, logger log.Log
name := DdbBaseName(settings)

repository, err := ddb.NewRepository(ctx, config, logger, &ddb.Settings{
ClientName: settings.DdbSettings.ClientName,
ModelId: mdl.ModelId{
Project: settings.Project,
Environment: settings.Environment,
Expand Down
1 change: 1 addition & 0 deletions pkg/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

type Settings struct {
cfg.AppId
DdbSettings DdbSettings
Name string
Ttl time.Duration
BatchSize int
Expand Down

0 comments on commit fd4ce31

Please sign in to comment.