Browse Source

Addresses issue 26 if i understand it correctly

Geoffrey Papilion 11 years ago
parent
commit
9a1537668c
1 changed files with 14 additions and 0 deletions
  1. 14 0
      zones.go

+ 14 - 0
zones.go

@@ -458,6 +458,20 @@ func setupZoneData(data map[string]interface{}, Zone *Zone) {
 		}
 		}
 	}
 	}
 
 
+	// loop over exisiting labels, create zone records for missing sub-domains
+	for k := range Zone.Labels {
+		if strings.Contains(k, ".") {
+			subLabels := strings.Split(k, ".")
+			for i := 1; i < len(subLabels); i++ {
+				subSubLabel := strings.Join(subLabels[i:len(subLabels)], ".")
+				if _, ok := Zone.Labels[subSubLabel]; !ok {
+					Zone.AddLabel(subSubLabel)
+				}
+			}
+
+		}
+	}
+
 	setupSOA(Zone)
 	setupSOA(Zone)
 
 
 	//log.Println(Zones[k])
 	//log.Println(Zones[k])