Skip to content

Commit

Permalink
fix bug with config.consumer_groups field
Browse files Browse the repository at this point in the history
  • Loading branch information
GGabriele committed Jul 26, 2023
1 parent 0a896f6 commit fce04dc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions file/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,11 +933,17 @@ func (b *stateBuilder) plugins() {

if b.isConsumerGroupScopedPluginSupported && *p.Name == ratelimitingAdvancedPluginName {
// check if deprecated consumer-groups configuration is present in the config
_, consumerGroupsFound := p.Config["consumer_groups"]
var consumerGroupsFound bool
if groups, ok := p.Config["consumer_groups"]; ok {
// if groups is an array of length > 0, then consumer_groups is set
if groupsArray, ok := groups.([]interface{}); ok && len(groupsArray) > 0 {
consumerGroupsFound = true
}
}
_, enforcedConsumerGroupFound := p.Config["enforced_consumer_group"]
if consumerGroupsFound || enforcedConsumerGroupFound {
b.err = errors.New("a rate-limiting-advanced plugin with config.consumer_groups\n" +
"and/or config.enforced_consumer_group was found. Please use Consumer Groups scoped\n" +
"and/or config.enforce_consumer_group was found. Please use Consumer Groups scoped\n" +
"Plugins when running against Kong Enterprise 3.4.0 and above.\n\n" +
"Check DOC_LINK for more information")
return
Expand Down

0 comments on commit fce04dc

Please sign in to comment.