Files
David ReissandGitHub 2a38f9584b Dynamic config conversion improvements (#7052)
## What changed?
- Split implementation of "constrained default" settings from "plain
default" settings. This is more code and the diff looks complex, but the
individual paths are both simpler than the mixed version.
- Add conversion cache using a weak map.
- Remove GlobalCachedTypedValue.
- Use "raw" values for subscription dispatch deduping to avoid
unnecessary conversions.
- Deep copy default values when using mapstructure, to avoid problems
with merging over shared default values.

## Why?
- Fixes #6756
- Performance improvement for "plain default" settings (almost all of
them)
- Performance improvement for settings with complex converters
- Remove footgun in defaults that aren't scalar values

## How did you test it?
existing+new unit tests
2025-08-08 08:32:58 -07:00

24 lines
524 B
Go

package dynamicconfig
import (
"regexp"
"github.com/mitchellh/mapstructure"
"go.temporal.io/server/common/util"
)
var (
MatchAnythingRE = regexp.MustCompile(".*")
MatchNothingRE = regexp.MustCompile(".^")
)
func ConvertWildcardStringListToRegexp(in any) (*regexp.Regexp, error) {
// first convert raw value to list of strings
var patterns []string
if err := mapstructure.Decode(in, &patterns); err != nil {
return nil, err
}
// then turn strings into regexp
return util.WildCardStringsToRegexp(patterns)
}