diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | README | 2 | ||||
| -rw-r--r-- | argv.go | 10 | ||||
| -rw-r--r-- | daemon.go (renamed from watchdog.go) | 1 | ||||
| -rw-r--r-- | main.go | 19 |
5 files changed, 29 insertions, 5 deletions
@@ -9,7 +9,7 @@ REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE= all: build ./zood --version - ./zood + ./zood test build: goimports GO111MODULE=off go build -v -x \ @@ -1 +1,3 @@ This is the zookeeper daemon. + +It is simple. It's just designed to keep packages up to date. @@ -16,9 +16,13 @@ import ( var argv args type args struct { - Daemon bool `arg:"--daemon" default:"false" help:"run in daemon mode"` - Port int `arg:"--port" default:"2521" help:"port to run on"` - URL string `arg:"--url" help:"url to use"` + Test *EmptyCmd `arg:"subcommand:test" help:"New to forge? This is for you.'"` + Daemon bool `arg:"--daemon" default:"false" help:"run in daemon mode"` + Port int `arg:"--port" default:"2521" help:"port to run on"` + URL string `arg:"--url" help:"url to use"` +} + +type EmptyCmd struct { } func (args) Version() string { @@ -16,6 +16,7 @@ func TimeFunction(f func()) time.Duration { return time.Since(startTime) // Calculate the elapsed time } +// sends updates to zookeeper func zood() { me.dog = time.NewTicker(me.pollDelay) defer me.dog.Stop() @@ -34,7 +34,7 @@ func main() { } me = new(stuff) - me.urlbase = "http://zookeeper.grid.wit.com:8080" + me.urlbase = "http://zookeeper.chap.wit.com:8080" if argv.URL != "" { log.Info("USING ARGV URL:", argv.URL) me.urlbase = argv.URL @@ -45,5 +45,22 @@ func main() { me.machine = zoopb.InitMachine() + if argv.Test != nil { + testURL(me.urlbase, me.machine) + os.Exit(0) + } + zood() // talks to zookeeper } + +func testURL(urlbase string, pb *zoopb.Machine) error { + newpb, wsPB, err := pb.HttpPost(urlbase, "test") + if err != nil { + log.Info("got error:", err) + return err + } + wsPB.DumpClient() + newpb.Dump() + log.Info("got error:", err) + return err +} |
