diff --git a/src/models/cfg.go b/src/models/cfg.go index ab31568..abec549 100644 --- a/src/models/cfg.go +++ b/src/models/cfg.go @@ -25,6 +25,11 @@ func (wl Whitelist) Insert(cfg config.Config) (err error) { exists, _ := cfg.Db.Get(&w) if exists { existing, _ := GetWhitelists(cfg) + for _, j := range existing { + if j == wl.IP { + return fmt.Errorf("ip %s already in config", j) + } + } existing = append(existing, wl.IP) w.Value = strings.Join(existing, ",") cfg.Db.ID(w.ID).Update(&w)