Skip to content

Commit

Permalink
fix: strip @docker when removing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan committed Dec 7, 2021
1 parent b774c3b commit e69bd05
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion store.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (s *Store) swapKeys(setkey string) error {
// e.g., traefik/http/routers/nginx@docker
func (s Store) k(sk, b string) string {
k := strings.ReplaceAll(fmt.Sprintf("traefik_%s", sk), "_", "/")
b = strings.TrimSuffix(b, "@docker")
return fmt.Sprintf("%s/%s", k, b)
}

Expand All @@ -121,7 +122,9 @@ func (s *Store) removeKeys(setkey string, keys []string) error {
logrus.Debugf("removing keys from %s: %s", setkey, strings.Join(keys, ","))
}
for _, removeKey := range keys {
res, err := s.client.Keys(s.k(setkey, removeKey) + "/*").Result()
keyPath := s.k(setkey, removeKey) + "/*"
logrus.Debugf("removing keys matching %s", keyPath)
res, err := s.client.Keys(keyPath).Result()
if err != nil {
return errors.Wrap(err, "fetch failed")
}
Expand Down

0 comments on commit e69bd05

Please sign in to comment.