feat!: simplified rule with regex instead of boolean

BREAKING CHANGE: the "regex" field in the rule is now a regular expression instead of a boolean.
This commit is contained in:
Henrique Dias
2024-07-29 10:11:02 +02:00
parent d3732322bc
commit e7e9c3176d
7 changed files with 22 additions and 25 deletions
+6 -1
View File
@@ -6,6 +6,7 @@ import (
"path/filepath"
"strings"
"github.com/go-viper/mapstructure/v2"
"github.com/spf13/pflag"
"github.com/spf13/viper"
)
@@ -101,7 +102,11 @@ func ParseConfig(filename string, flags *pflag.FlagSet) (*Config, error) {
}
cfg := &Config{}
err = v.Unmarshal(cfg)
err = v.Unmarshal(cfg, viper.DecodeHook(mapstructure.ComposeDecodeHookFunc(
mapstructure.StringToTimeDurationHookFunc(),
mapstructure.StringToSliceHookFunc(","),
mapstructure.TextUnmarshallerHookFunc(),
)))
if err != nil {
return nil, err
}