(queryAttributes []QueryAttribute, regexChanged bool, newCompiledRegex map[string]*regexp.Regexp)
| 569 | } |
| 570 | |
| 571 | func (l *Limits) compileQueryAttributeRegexes(queryAttributes []QueryAttribute, regexChanged bool, newCompiledRegex map[string]*regexp.Regexp) error { |
| 572 | for j, attribute := range queryAttributes { |
| 573 | if regexChanged { |
| 574 | compiledRegex, err := regexp.Compile(attribute.Regex) |
| 575 | if err != nil { |
| 576 | return errors.Join(errCompilingQueryPriorityRegex, err) |
| 577 | } |
| 578 | newCompiledRegex[attribute.Regex] = compiledRegex |
| 579 | queryAttributes[j].CompiledRegex = compiledRegex |
| 580 | |
| 581 | compiledUserAgentRegex, err := regexp.Compile(attribute.UserAgentRegex) |
| 582 | if err != nil { |
| 583 | return errors.Join(errCompilingQueryPriorityRegex, err) |
| 584 | } |
| 585 | newCompiledRegex[attribute.UserAgentRegex] = compiledUserAgentRegex |
| 586 | queryAttributes[j].CompiledUserAgentRegex = compiledUserAgentRegex |
| 587 | } else { |
| 588 | queryAttributes[j].CompiledRegex = l.queryAttributeCompiledRegex[attribute.Regex] |
| 589 | queryAttributes[j].CompiledUserAgentRegex = l.queryAttributeCompiledRegex[attribute.UserAgentRegex] |
| 590 | } |
| 591 | } |
| 592 | return nil |
| 593 | } |
| 594 | |
| 595 | // When we load YAML from disk, we want the various per-customer limits |
| 596 | // to default to any values specified on the command line, not default |
no test coverage detected