Эх сурвалжийг харах

Make the zone file an argument

Signed-off-by: Antoine Tenart <antoine.tenart@ack.tf>
Antoine Tenart 6 жил өмнө
parent
commit
2e0e3521ba
1 өөрчлөгдсөн 6 нэмэгдсэн , 2 устгасан
  1. 6 2
      main.go

+ 6 - 2
main.go

@@ -11,8 +11,6 @@ import (
 )
 
 var (
-	zone_file = "tmp"
-
 	lists = []string{
 		"https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts",
 		"https://mirror1.malwaredomains.com/files/justdomains",
@@ -32,6 +30,12 @@ var (
 )
 
 func main() {
+	if len(os.Args) < 2 {
+		log.Fatal("Please provide a zone file to write to.")
+	}
+
+	zone_file := os.Args[1]
+
 	// Open the zone file, and create it if needed
 	f, err := os.OpenFile(zone_file, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
 	if err != nil {