Make records toggleable via `disabled` attribute

master
Lauri Võsandi 2 years ago
parent d74fcd0a47
commit 80205e1581
  1. 4
      main.go

@ -58,13 +58,13 @@ func appendResults(etype string, name string, m *dns.Msg, cur *mongo.Cursor) int
func query(tp string, name string, m *dns.Msg, coll *mongo.Collection) {
// TODO: Validate `name` against RE_FQDN
log.Printf("Query %s for %s\n", tp, name)
cur, err := coll.Find(context.TODO(), bson.M{"dns.fqdn": name})
cur, err := coll.Find(context.TODO(), bson.M{"dns.fqdn": name, "disabled": false})
if err != nil {
log.Fatal(err)
}
if appendResults(tp, name, m, cur) == 0 {
cur, err := coll.Find(context.TODO(), bson.M{"dns.san": name})
cur, err := coll.Find(context.TODO(), bson.M{"dns.san": name, "disabled": false})
if err != nil {
log.Fatal(err)
}

Loading…
Cancel
Save