Skip to content

Commit

Permalink
Add composite ConfigStore to combine multiple ConfigStore (#3027)
Browse files Browse the repository at this point in the history
In some repositories, we used multiple ConfigStores to store feature
flags, for example, in eventing kafka broker, we use the Eventing
core feature flags store and the EKB feature flags store

Signed-off-by: Pierangelo Di Pilato <[email protected]>
  • Loading branch information
pierDipi authored May 15, 2024
1 parent b1fd04d commit 11a3d46
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion reconciler/configstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ import "context"

// ConfigStore is used to attach the frozen configuration to the context.
type ConfigStore interface {
// ConfigStore is used to attach the frozen configuration to the context.
// ToContext is used to attach the frozen configuration to the context.
ToContext(ctx context.Context) context.Context
}

// ConfigStores is used to combine multiple ConfigStore and attach multiple frozen configurations
// to the context.
type ConfigStores []ConfigStore

// ConfigStores implements ConfigStore interface.
var _ ConfigStore = ConfigStores{}

func (stores ConfigStores) ToContext(ctx context.Context) context.Context {
for _, s := range stores {
ctx = s.ToContext(ctx)
}
return ctx
}

0 comments on commit 11a3d46

Please sign in to comment.