adding url debugging

This commit is contained in:
Jeff Carr 2025-09-22 01:50:15 -05:00
parent aeae4ddf46
commit 3a786d60fd
5 changed files with 29 additions and 5 deletions

View File

@ -9,7 +9,7 @@ REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE=
all: build all: build
./zood --version ./zood --version
./zood ./zood test
build: goimports build: goimports
GO111MODULE=off go build -v -x \ GO111MODULE=off go build -v -x \

2
README
View File

@ -1 +1,3 @@
This is the zookeeper daemon. This is the zookeeper daemon.
It is simple. It's just designed to keep packages up to date.

10
argv.go
View File

@ -16,9 +16,13 @@ import (
var argv args var argv args
type args struct { type args struct {
Daemon bool `arg:"--daemon" default:"false" help:"run in daemon mode"` Test *EmptyCmd `arg:"subcommand:test" help:"New to forge? This is for you.'"`
Port int `arg:"--port" default:"2521" help:"port to run on"` Daemon bool `arg:"--daemon" default:"false" help:"run in daemon mode"`
URL string `arg:"--url" help:"url to use"` 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 { func (args) Version() string {

View File

@ -16,6 +16,7 @@ func TimeFunction(f func()) time.Duration {
return time.Since(startTime) // Calculate the elapsed time return time.Since(startTime) // Calculate the elapsed time
} }
// sends updates to zookeeper
func zood() { func zood() {
me.dog = time.NewTicker(me.pollDelay) me.dog = time.NewTicker(me.pollDelay)
defer me.dog.Stop() defer me.dog.Stop()

19
main.go
View File

@ -34,7 +34,7 @@ func main() {
} }
me = new(stuff) me = new(stuff)
me.urlbase = "http://zookeeper.grid.wit.com:8080" me.urlbase = "http://zookeeper.chap.wit.com:8080"
if argv.URL != "" { if argv.URL != "" {
log.Info("USING ARGV URL:", argv.URL) log.Info("USING ARGV URL:", argv.URL)
me.urlbase = argv.URL me.urlbase = argv.URL
@ -45,5 +45,22 @@ func main() {
me.machine = zoopb.InitMachine() me.machine = zoopb.InitMachine()
if argv.Test != nil {
testURL(me.urlbase, me.machine)
os.Exit(0)
}
zood() // talks to zookeeper 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
}