Browse Source

add --workers to main

master
Brett Langdon 10 years ago
parent
commit
e1a85c507d
1 changed files with 10 additions and 3 deletions
  1. +10
    -3
      cmd/realm/main.go

+ 10
- 3
cmd/realm/main.go View File

@ -3,21 +3,28 @@ package main
import (
"log"
"os"
"runtime"
"github.com/alexflint/go-arg"
"github.com/brettlangdon/realm"
)
var args struct {
Zones []string `arg:"--zone,positional,help:DNS zone files to serve from this server"`
Bind string `arg:"help:[<host>]:<port> to bind too"`
StatsD string `arg:"--statsd,help:<host>:<port> to send StatsD metrics to"`
Zones []string `arg:"--zone,positional,help:DNS zone files to serve from this server"`
Bind string `arg:"help:[<host>]:<port> to bind too"`
StatsD string `arg:"--statsd,help:<host>:<port> to send StatsD metrics to"`
Workers int `arg:"--workers,help:number of workers to start [default: $GOMAXPROCS]`
}
func main() {
args.Bind = ":53"
argParser := arg.MustParse(&args)
// Control number of workers via GOMAXPROCS
if args.Workers > 0 {
runtime.GOMAXPROCS(args.Workers)
}
if len(args.Zones) == 0 {
log.Println("must supply at least 1 zone file to serve")
argParser.WriteUsage(os.Stderr)


Loading…
Cancel
Save