allow specifying multiple cache with spaces

this is necessary for the new environment variable support for config
values.  I don't love that allowHosts is comma separated and cache is
space separated :(
This commit is contained in:
Will Norris 2019-06-09 22:09:55 +00:00
parent d8ed21c0f4
commit fe437a0b8c
2 changed files with 15 additions and 13 deletions

View file

@ -122,15 +122,17 @@ func (tc *tieredCache) String() string {
}
func (tc *tieredCache) Set(value string) error {
c, err := parseCache(value)
if err != nil {
return err
}
for _, v := range strings.Fields(value) {
c, err := parseCache(v)
if err != nil {
return err
}
if tc.Cache == nil {
tc.Cache = c
} else {
tc.Cache = twotier.New(tc.Cache, c)
if tc.Cache == nil {
tc.Cache = c
} else {
tc.Cache = twotier.New(tc.Cache, c)
}
}
return nil
}