Browse Source

Add option to specify configuration directory

Closes #10
Ask Bjørn Hansen 13 years ago
parent
commit
51fb55ad14
2 changed files with 7 additions and 6 deletions
  1. 1 1
      README.md
  2. 6 5
      geodns.go

+ 1 - 1
README.md

@@ -21,7 +21,7 @@ curl -o dns/example.com.json http://tmp.askask.com/2012/08/dns/example.com.json
 
 ## Run it
 
-`go run *.go -log -run`
+`go run *.go -run -log -interface 127.1 -port 8053`
 
 To test the responses run
 

+ 6 - 5
geodns.go

@@ -19,10 +19,11 @@ var timeStarted = time.Now()
 var qCounter uint64 = 0
 
 var (
-	flagint  = flag.String("interface", "*", "set the listener address")
-	flagport = flag.String("port", "53", "default port number")
-	flaglog  = flag.Bool("log", false, "be more verbose")
-	flagrun  = flag.Bool("run", false, "run server")
+	flagconfig = flag.String("config", "./dns/", "directory of zone files")
+	flagint    = flag.String("interface", "*", "set the listener address")
+	flagport   = flag.String("port", "53", "default port number")
+	flaglog    = flag.Bool("log", false, "be more verbose")
+	flagrun    = flag.Bool("run", false, "run server")
 
 	cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
 	memprofile = flag.String("memprofile", "", "write memory profile to this file")
@@ -61,7 +62,7 @@ func main() {
 
 	go monitor()
 
-	dirName := "dns"
+	dirName := *flagconfig
 
 	Zones := make(Zones)