From fd4ce31e83d45df75e174f7274216619bf1ac88b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Stru=C3=9F?= Date: Tue, 23 May 2023 10:02:45 +0200 Subject: [PATCH] ensure ddb kvstore can use client_name as well (kvstore.name.ddb.client_name) --- pkg/kvstore/configurable.go | 6 ++++++ pkg/kvstore/ddb.go | 1 + pkg/kvstore/kvstore.go | 1 + 3 files changed, 8 insertions(+) diff --git a/pkg/kvstore/configurable.go b/pkg/kvstore/configurable.go index c80ec615e..1be5f342a 100644 --- a/pkg/kvstore/configurable.go +++ b/pkg/kvstore/configurable.go @@ -18,6 +18,10 @@ const ( TypeRedis = "redis" ) +type DdbSettings struct { + ClientName string `cfg:"client_name" default:"default"` +} + type ChainConfiguration struct { Project string `cfg:"project"` Family string `cfg:"family"` @@ -25,6 +29,7 @@ type ChainConfiguration struct { 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"` @@ -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, diff --git a/pkg/kvstore/ddb.go b/pkg/kvstore/ddb.go index c443eac1c..fe6172cf1 100644 --- a/pkg/kvstore/ddb.go +++ b/pkg/kvstore/ddb.go @@ -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, diff --git a/pkg/kvstore/kvstore.go b/pkg/kvstore/kvstore.go index fad75f684..41ce295a9 100644 --- a/pkg/kvstore/kvstore.go +++ b/pkg/kvstore/kvstore.go @@ -13,6 +13,7 @@ import ( type Settings struct { cfg.AppId + DdbSettings DdbSettings Name string Ttl time.Duration BatchSize int