adding url debugging
This commit is contained in:
parent
aeae4ddf46
commit
3a786d60fd
2
Makefile
2
Makefile
|
@ -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 \
|
||||
|
|
2
README
2
README
|
@ -1 +1,3 @@
|
|||
This is the zookeeper daemon.
|
||||
|
||||
It is simple. It's just designed to keep packages up to date.
|
||||
|
|
4
argv.go
4
argv.go
|
@ -16,11 +16,15 @@ import (
|
|||
var argv args
|
||||
|
||||
type args struct {
|
||||
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 {
|
||||
return "zood " + VERSION + " Built on: " + BUILDTIME
|
||||
}
|
||||
|
|
|
@ -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()
|
19
main.go
19
main.go
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue