Add adds a rule to the list of rules, and optionally saves it to disk.
(rule *Rule, saveToDisk bool)
| 157 | |
| 158 | // Add adds a rule to the list of rules, and optionally saves it to disk. |
| 159 | func (l *Loader) Add(rule *Rule, saveToDisk bool) error { |
| 160 | l.addUserRule(rule) |
| 161 | if saveToDisk { |
| 162 | fileName := filepath.Join(l.Path, fmt.Sprintf("%s.json", rule.Name)) |
| 163 | return l.Save(rule, fileName) |
| 164 | } |
| 165 | return nil |
| 166 | } |
| 167 | |
| 168 | // Replace adds a rule to the list of rules, and optionally saves it to disk. |
| 169 | func (l *Loader) Replace(rule *Rule, saveToDisk bool) error { |